Re: [go-nuts] Is golang.org/x/text/message's Printer thread safe?

2024-04-22 Thread Jan Mercl
On Mon, Apr 22, 2024 at 11:23 AM Xiangrong Fang wrote: > Is golang.org/x/text/message's *message.Printer safe to use in goroutines? I don't know, but usually things are safe for concurrent use by multiple goroutines only when explicitly documented as such. -- You received this message because

Re: [go-nuts] Nillable basic types?

2024-03-18 Thread Jan Mercl
On Mon, Mar 18, 2024 at 4:41 AM Daniel Lepage wrote: > This change would be entirely backward-compatible ... Let's consider, for example, the type uint8, aka byte. A variable of type byte is specified* to occupy 8 bits of memory and has 256 possible values. To represent all those values and the

Re: [go-nuts] GO111MODULE=off go get deprecated?

2024-03-07 Thread Jan Mercl
On Sun, Mar 3, 2024 at 10:25 PM Jeffery Carr wrote: > Has this been deprecated or maybe it is broken in debian sid, but: > > bash$ GO111MODULE=off go get -v go.wit.com/apps/test > go: modules disabled by GO111MODULE=off; see 'go help modules' > basj$ go version > go version go1.22.0 linux/amd64

Re: [go-nuts] Enums, Go1 and proposals

2024-03-04 Thread Jan Mercl
On Mon, Mar 4, 2024 at 6:19 PM Jeremy French wrote: > More, to prevent PrintMonth(14), which the function would have to check for > and either return an error or panic, since there is no meaningful output. In > fact, it's fairly easy to see, even in this case, where the PrintMonth >

Re: [go-nuts] Enums, Go1 and proposals

2024-03-04 Thread Jan Mercl
On Mon, Mar 4, 2024 at 4:19 PM Jeremy French wrote: > It's checked at compile-time rather than run time. That requires immutability of variables of enum type. Go does not support immutable variables. -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Equality of interface of an empty struct - why?

2024-02-26 Thread Jan Mercl
On Tue, Feb 27, 2024 at 6:20 AM tapi...@gmail.com wrote: > From common sense, this is an obvious bug. But the spec is indeed not clear > enough. > It doesn't state whether or not comparisons of pointers to two distinct > zero-size variables should be consistent in a run session. > Though, from

Re: [go-nuts] Unhappy with the official generics tutorial

2024-02-22 Thread Jan Mercl
On Thu, Feb 22, 2024 at 10:06 AM 'Carla Pfaff' via golang-nuts wrote: > This omission is notable considering "any" is among the most frequently used > constraints in writing generic code. Interesting to know, I'd naively guess the opposite. Can you please share the source data set? Thank you.

Re: [go-nuts] Ghost/indirect dependency on a custom package

2024-02-20 Thread Jan Mercl
On Tue, Feb 20, 2024 at 11:07 AM Peter Bočan wrote: > Is there a way to debug this? Is there a way to step over the initialisation > order? I try to get help from '$ go mod graph' in similar investigations. -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] big int panic on text conversion

2024-02-14 Thread Jan Mercl
On Wed, Feb 14, 2024 at 12:14 PM 'Dan Kortschak' via golang-nuts wrote: > Given that this can happen without a race or unsafe modifications it > might be worth filing a issue for. I think this is expected. Quoting from the big.Int docs https://pkg.go.dev/math/big#Int To "copy" an Int

Re: [go-nuts] How could we emulate condition variables using Go channels only?

2024-01-12 Thread Jan Mercl
On Fri, Jan 12, 2024 at 7:57 PM Rochus Keller wrote: > Here is the full question with examples (though meanwhile closed as usual in > recent times on stackoverflow, so answer here please): >

Re: [go-nuts] Re: Rendering fonts in Go

2024-01-12 Thread Jan Mercl
On Fri, Jan 12, 2024 at 12:34 PM 'Brian Candler' via golang-nuts wrote: > At worst, it may possible to compile C into Go. It sounds mad, but I believe > SQLite has been ported to pure Go this way. Challenge accepted: https://pkg.go.dev/modernc.org/libfreetype -- You received this message

Re: [go-nuts] Re: A global panic handler for crash reporting

2023-12-26 Thread Jan Mercl
On Tue, Dec 26, 2023 at 9:12 AM Gergely Brautigam wrote: > If you have a top level recover in you main, it doesn't matter where the > panic happens, you'll capture it. Even in third party library. Iff the panic occurs in the same goroutine where the defer is. Every go statement starts a new

Re: [go-nuts] circular package dependency between golang.org/x/mod and golang.org/x/tools

2023-12-19 Thread Jan Mercl
On Tue, Dec 19, 2023 at 9:37 PM Nathan Lacey wrote: > I noticed that we have a circular dependency between golang.org/x/mod and > golang.org/x/tools > > golang.org/x/mod zip/zip_test.go includes golang.org/x/tools > I think we could get rid of the circular package dependency by changing that

Re: [go-nuts] Need help running "go get" on self hosted git server

2023-12-18 Thread Jan Mercl
On Mon, Dec 18, 2023 at 2:19 PM Brijesh Wawdhane wrote: > I added a go-import meta tag to my git server's website on the repo page and it looks like > > https://brijesh.dev/kairos.git;> > > but when I try running "go get brijesh.dev/kairos" I get an error saying 'go: unrecognized import path

Re: [go-nuts] detecting deleted file that is still open and appending without error in Go?

2023-12-10 Thread Jan Mercl
On Sun, Dec 10, 2023 at 8:34 PM Jason E. Aten wrote: > I noticed that the binary log was not growing, and its update timestamp was > not changing. I think the file was still growing as intended. It was only no more associated with the _new_ entry/name in the directory. I'm pointing it out

Re: [go-nuts] detecting deleted file that is still open and appending without error in Go?

2023-12-10 Thread Jan Mercl
On Sun, Dec 10, 2023 at 5:41 PM Jason E. Aten wrote: > My question is: is there a way to have the Go process detect if the file it > is writing to has been deleted by another process (git in this case) so that > attempting to append to the file is no longer effective? It is effective and

Re: [go-nuts] Go ARM

2023-11-15 Thread Jan Mercl
On Wed, Nov 15, 2023 at 9:59 PM Stephen Illingworth wrote: > > That works better although not perfectly for my purposes. More work required > from me. > > I'm curious though, about the -marm flag. How can I remove it from the > GOGCCFLAGS variable? Or are we saying we can't use the aarch64

Re: [go-nuts] Go ARM

2023-11-15 Thread Jan Mercl
On Wed, Nov 15, 2023 at 8:30 PM Stephen Illingworth < stephen.illingwo...@gmail.com> wrote: > I'm trying to build a project on the Raspberry Pi, natively. > > Using "go env" I can see that Go has the following value for GOGCCFLAGS > > GOGCCFLAGS='-fPIC -marm -Wl,--no-gc-sections -fmessage-length=0

Re: [go-nuts] ldflags -X

2023-11-08 Thread Jan Mercl
On Wed, Nov 8, 2023 at 4:01 PM Stephen Illingworth wrote: > I would have expected the "main.A" string to require the same form. But > either way, that's the correct solution. It is the correct form. Package main cannot be imported and has a special import path. Though I don't know where it is

Re: [go-nuts] ldflags -X

2023-11-08 Thread Jan Mercl
On Wed, Nov 8, 2023 at 1:35 PM Stephen Illingworth < stephen.illingwo...@gmail.com> wrote: > > Hello, > > I'm trying to use the -X ldflag to set a string at compile time. I can do this successfully if the string is in the main package but it does not work if the string is in a subpackage. > > For

Re: [go-nuts] Re: Why causes []any trouble in type equations?

2023-10-11 Thread Jan Mercl
On Wed, Oct 11, 2023 at 8:11 PM Torsten Bronger wrote: > Then, all boils down to the fact that you can’t pass []float64 as an > []any. To be honest, I still don’t fully understand why this is > forbidden, so I just accept that the language does not allow it. It's the same reason why one cannot

Re: [go-nuts] how do you compie and link a go main with an assembly code file?

2023-10-09 Thread Jan Mercl
On Mon, Oct 9, 2023 at 6:02 PM Peter Riemenschneider wrote: Just '$ go build' as usual, but one must declare the asm function: https://go.dev/play/p/KySqFvCVz_T -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

Re: [go-nuts] The docs for secretbox seem very wrong

2023-10-09 Thread Jan Mercl
On Mon, Oct 9, 2023 at 3:46 PM Dean Schulze wrote: > If the docs are correct, how do you append to nil? https://go.dev/play/p/WY0Bycj-_Tn -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails

Re: [go-nuts] Help understanding slices, variable arguments, and passing slices to functions

2023-09-25 Thread Jan Mercl
On Mon, Sep 25, 2023 at 1:57 PM Andrew Pillar wrote: A nice discussion of slices can be found for example here: https://research.swtch.com/godata tl;dr: Yes, slices are passed by value (everything in Go is passed by value), but a slice does not contain the backing array, only a pointer to it.

Re: [go-nuts] Re: Weird error when trying to fetch a module.

2023-09-15 Thread Jan Mercl
On Fri, Sep 15, 2023 at 10:31 AM 'Jim Idle' via golang-nuts < golang-nuts@googlegroups.com> wrote: > The go.mod at the root was one thing that might work, but it will cause the entire repo to be pulled in so the tag will still have to be sec/go/ etc. tl;dr: Putting a go.mod in the repository

Re: [go-nuts] How ignore a subdirectory

2023-09-13 Thread Jan Mercl
On Wed, Sep 13, 2023 at 12:25 PM John Souvestre wrote: > I did try that also. I get this error message: > > CreateFile *.go: The filename, directory name, or volume label syntax is incorrect. Sorry, I'm not familiar with Windows and only TIL cmd.exe does not expand globs. I suggest to

Re: [go-nuts] How ignore a subdirectory

2023-09-13 Thread Jan Mercl
On Wed, Sep 13, 2023 at 5:47 AM 'John Souvestre' via golang-nuts wrote: > I’m trying to run gofmt on all of the .go files in a directory, but not any > subdirectories. $ gofmt *.go -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] How to constrain an integral type's values

2023-09-08 Thread Jan Mercl
On Fri, Sep 8, 2023 at 9:24 AM 'Mark' via golang-nuts wrote: > Is there a compile-time solution for this that I've missed? No. Go does not have enum types. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

Re: [go-nuts] Re: Best IDE for GO ?

2023-08-26 Thread Jan Mercl
On Sat, Aug 26, 2023 at 2:33 PM Jason E. Aten wrote: > > Is there any IDE that allows you to jump through a stack trace like emacs > does? I think many code editors can do that, for example vim: https://vim.fandom.com/wiki/Open_file_under_cursor -- You received this message because you are

Re: [go-nuts] Best IDE for GO ?

2023-08-19 Thread Jan Mercl
On Sat, Aug 19, 2023 at 10:06 PM Christian Stewart wrote: > Autocomplete and a go language server (gopls) add a ton of speed because you > don't need to look up the docs for function and variable names. And go to > definition improves speed navigating code significantly. - Using autocomplete

Re: [go-nuts] Best IDE for GO ?

2023-08-19 Thread Jan Mercl
On Sat, Aug 19, 2023 at 9:42 PM Robert Engels wrote: > I guarantee that two developers of equal competence - the one with a powerful > IDE will outperform the other using a text editor with syntax highlighting > (but come on that is a crutch a real developer doesn’t need) by 2-10x > depending

Re: [go-nuts] Best IDE for GO ?

2023-08-19 Thread Jan Mercl
On Sat, Aug 19, 2023 at 11:27 AM alex-coder wrote: > Gophers, may be there is another place where I should look for IDE for GO ? Unix is my IDE and vim is its prophet. IME IDEs make programmers write low quality code while enjoying the illusion of being "more productive". -- You received

Re: [go-nuts] Re: Go 1.21.0 is released

2023-08-09 Thread Jan Mercl
On Wed, Aug 9, 2023, 09:12 Marcello H wrote: > https://go.dev/dl/go1.21.0.windows-arm64.zip > > It is found when you click on "Other Ports" Thanks. I may have a false memory of always finding the windows/arm64 port beside the windows/amd64 one in the same section. -j -- You received this

[go-nuts] Re: Go 1.21.0 is released

2023-08-08 Thread Jan Mercl
On Tue, Aug 8, 2023 at 5:24 PM wrote: > We have just released Go 1.21.0. > > To find out what has changed in Go 1.21, read the release notes: > https://go.dev/doc/go1.21 > > You can download binary and source distributions from our download page: > https://go.dev/dl/#go1.21.0 It looks like the

Re: [go-nuts] Re: How to convert an svg to a png (or gif) image?

2023-08-04 Thread Jan Mercl
On Fri, Aug 4, 2023 at 1:22 PM Brian Candler wrote: > Also there's a project which compiles C code to Go - ISTR it was used to > build a pure Go version of Sqlite. Presumably the same approach could be > applied to an image processing library. > >

Re: [go-nuts] Re: Error handling

2023-08-01 Thread Jan Mercl
On Tue, Aug 1, 2023 at 1:47 AM DrGo wrote: > The verbosity of error handling is the number one concern for Go developers > in the most recent survey. That says something about those developers, about their preferences, opinions, taste etc and that it differs from what the Original Language

Re: [go-nuts] [go test] pure Test Classes.

2023-07-26 Thread Jan Mercl
On Wed, Jul 26, 2023 at 9:44 AM sumith s wrote: > Currently, we do not have pure Test Classes defined by us. We are using > Golang specific Test Class structure. Each FILENAME_test.go will have its own > test class under "Golang Test". > I'm trying to define a pure Test Classes. how can do

Re: [go-nuts] go package dating back to 2009

2023-07-25 Thread Jan Mercl
On Wed, Jul 26, 2023 at 12:32 AM Bravo Moua wrote: > For a fact, bytes, fmt, and packages in those category are from Satoshi > Nakamoto and myself. Extraordinary claims require extraordinary evidence. -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] no way to pause `Listen` on net connections

2023-07-24 Thread Jan Mercl
On Mon, Jul 24, 2023 at 9:26 AM David N wrote: > Yup, this makes sense and should work, but I'm still surprised this can't be > entirely done in Golang. Who says it's not possible? I'm not aware of a reason why the required parts cannot be implemented in pure Go (+ syscalls + right permission

Re: [go-nuts] no way to pause `Listen` on net connections

2023-07-24 Thread Jan Mercl
On Mon, Jul 24, 2023 at 9:14 AM David N wrote: On Linux you may try fiddling with iptables, limitations apply: https://stackoverflow.com/questions/44464617/stop-accepting-new-tcp-connections-without-dropping-any-existing-ones/44509993#44509993 -- You received this message because you are

Re: [go-nuts] testing whether two maps are the same object

2023-07-18 Thread Jan Mercl
On Tue, Jul 18, 2023 at 4:35 PM Jochen Voss wrote: > Is there a better way? I have never been here and please don't do this: https://go.dev/play/p/x4QYJubXMnQ -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

Re: [go-nuts] map type conversion

2023-07-16 Thread Jan Mercl
On Sun, Jul 16, 2023 at 6:02 PM Leonard Mittmann wrote: > Hi everyone, I am wondering if there is efficient way to do the following > type conversion (without looping over the map): > > var m = map[uint]uint{ /*...*/ } > type uintXXX uint > // this does not work > var m2 map[uintXXX]uintXXX =

Re: [go-nuts] Why not return after calling http.Error()

2023-07-04 Thread Jan Mercl
On Tue, Jul 4, 2023 at 5:38 PM Gurunandan Bhat wrote: > Every example of http Handler that I have seen so far looks like this: > > func handleSomeRequest(w http.ResponseWriter, r *http.Request) { > > // do something that returns an error > if err != nil { > http.Error(w,

Re: [go-nuts] delve crashes in presence of a circular reference variable

2023-06-23 Thread Jan Mercl
On Fri, Jun 23, 2023 at 10:38 AM christoph...@gmail.com wrote: > > Here is the minimal example code causing delve 1.20.2 to crash with a stack > overflow > > func TestExample(t *testing.T) { > type pptr *pptr > var p pptr > p = > t.Error("hello") > } > > Here is the stack trace

Re: [go-nuts] Please consider voting to reopen Golang subreddit

2023-06-23 Thread Jan Mercl
On Fri, Jun 23, 2023 at 10:18 AM Axel Wagner wrote: > Just for context, as not everyone seems to be aware: I was, in that sentence > you quoted, referring to examples like this > https://www.reddit.com/r/ModCoord/comments/14eq8ip/the_entire_rmildlyinteresting_mod_team_has_just/ > This

Re: [go-nuts] Please consider voting to reopen Golang subreddit

2023-06-23 Thread Jan Mercl
On Fri, Jun 23, 2023 at 7:01 AM 'Axel Wagner' via golang-nuts < golang-nuts@googlegroups.com> wrote: > And even *when* they ask and get overwhelming backing from their communities, ... Latest poll results on r/golang as of now: [image: image.png]

Re: [go-nuts] Why is reflect.CanAddr() returning false in this case ?

2023-06-22 Thread Jan Mercl
On Thu, Jun 22, 2023 at 12:16 PM christoph...@gmail.com wrote: > > I'm trying to get the uintptr address of a value p for which I have the > reflect.Value so that I can compare it with the value obtained with > v.Pointer() when p is a pointer. > > Here is a simple recursive pointer example code

Re: [go-nuts] Re: Using go run with #!

2023-06-21 Thread Jan Mercl
On Wed, Jun 21, 2023 at 8:33 PM Dzmitry Lahoda wrote: > > rust just got shebang and cargo in one file. i was hoping using go as good > fit for some cases. but seem it will be rust. we are go, bash, nix, rust > coders. sure there is some js in our repo. but i hate it. i like to so script >

Re: [go-nuts] Unexpected circular type definition limitation

2023-06-15 Thread Jan Mercl
On Thu, Jun 15, 2023 at 10:16 AM christoph...@gmail.com wrote: > It is possible to define two structures globally with mutual type dependency > as this: > > type A struct { > B []B > } > > type B struct { > A A[] > } > > but I just noticed that we can't do that inside a function: > >

Re: [go-nuts] Hosting to deploy && run exe ?

2023-06-11 Thread Jan Mercl
On Sun, Jun 11, 2023 at 7:40 PM alex-coder wrote: > Could you please advise me the simple hosting to deploy && run a small exe > assembled from go. I'm using https://www.hetzner.com/cloud?country=us and Google Cloud free tier. The later natively supports deployment of Go programs. -- You

Re: [go-nuts] Re: HTTP client timeout

2023-05-05 Thread Jan Mercl
On Fri, May 5, 2023 at 4:21 PM envee wrote: > > Thanks Jan. > My interface speed is 20 Gb/s > The payload size is about 2.8Kb. > So at 9000 Txn/s this works out to 9000 x 3 ≅27MB/s ≅ 200 Mb/s (This matches > the so (socket out) value shown in my atop command output) > I guess the interface speed

Re: [go-nuts] Re: HTTP client timeout

2023-05-05 Thread Jan Mercl
On Fri, May 5, 2023 at 2:45 PM envee wrote: > Still, I don't understand why I cannot achieve higher throughput than 9000 > per second. What is the max bitrate of the network interface used in the measurement and what is the size of the payload that has to get through for every connection? --

Re: [go-nuts] Re: Home directory?

2023-04-23 Thread Jan Mercl
On Sun, Apr 23, 2023 at 10:28 AM Amnon wrote: > Yes GOPATH and GOROOT have been deprecated. Both are alive and well. They are essential for the build system/go command to work as required. tl;dr: There's a default value of GOPATH so one does not have to set it. A much longer version can be

Re: [go-nuts] gofmt: expected declaration, found ')'

2023-04-16 Thread Jan Mercl
On Sun, Apr 16, 2023 at 12:51 PM Andreas Götz wrote: > Isn't gofmt ist part of the go command? Go ist the latest version: It is but it's a separate binary/executable file. Go version is one thing, the version of the binary file that is actually executed when '$ gofmt' is invoked is another

Re: [go-nuts] gofmt: expected declaration, found ')'

2023-04-16 Thread Jan Mercl
On Sun, Apr 16, 2023 at 12:17 PM Andreas Götz wrote: > > Good morning. Please excuse me for asking here- I'm stuck with something that > looks like a gofmt bug though that seems very unlikely. > > In CI > (https://github.com/evcc-io/evcc/actions/runs/4712710735/jobs/8357929411?pr=7485) > I'm

Fwd: [go-nuts] Redfining loop variable semantics - what's the plan?

2023-04-11 Thread Jan Mercl
Resending to the mailing list as that was my intention but I errored again. Did the gmail UI changed again? -- Forwarded message - From: Jan Mercl <0xj...@gmail.com> Date: Tue, Apr 11, 2023 at 9:11 AM Subject: Re: [go-nuts] Redfining loop variable semantics - what's th

Re: [go-nuts] Various questions about posts from The Go Blog

2023-03-26 Thread Jan Mercl
The only broken thing in the code below is the TestHello function. rsc.io/quote uses rsc.io/sampler where the Hello func (https://pkg.go.dev/rsc.io/sampler#Hello) is documented to return a localized string by default. Localized, in the sense of respecting the user's locale. That is not compatible

Re: [go-nuts] How to generalize parameters for a function

2023-03-15 Thread Jan Mercl
On Wed, Mar 15, 2023 at 11:03 AM Frank Jüdes wrote: > > Well, that didn't go very far: https://go.dev/play/p/UtsrRar9J0Q > Fails with the messages > ./prog.go:15:11: invalid operation: cannot index p_Map (variable of type MAP > constrained by DataMap) > ./prog.go:16:26: cannot range over p_Map

[go-nuts] Building Go 1.21 for openbsd/386

2023-02-22 Thread Jan Mercl
The subject target is not distributed by the Go team. Attempting to build if from sources in a qemu 4GB VM [OpenBSD 7.2 (GENERIC.MP) #404: Tue Sep 27 12:54:46 MDT 2022] via $ GOROOT_BOOTSTRAP=~/go1.19 nohup ./make.bash produces Building Go toolchain1 using /home/jnml/go1.19.

Re: [go-nuts] CGO Struct used as type parameter causes issue in Go 1.20

2023-02-16 Thread Jan Mercl
On Thu, Feb 16, 2023 at 8:22 AM Jan wrote: > Any thoughts ? A minimal, self-contained and runnable reproducer would be rather useful in this case. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] SIGSEGV: segmentation violation on Linux/ARM with Microchip SAM9x60 (ARM926 core) processor

2023-02-09 Thread Jan Mercl
A user filled https://gitlab.com/cznic/sqlite/-/issues/132, but I'm not able to reproduce it on RPi 4 and I don't have access to the subj. chip/system. It might be possibly something HW related, IDK. Looking for expert advice for the linux/arm Go target. Anyone out there? Thanks in advance. -j

Re: [go-nuts] Drain channel on demand without busy looping?

2023-02-05 Thread Jan Mercl
On Sun, Feb 5, 2023 at 5:12 PM cpu...@gmail.com wrote: > Would that still busy-loop? Are there better patterns? for range q.data {} iff the sending side properly closes the channel. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] Re: Context cancellation: Is it sufficient to make long-running things interruptible?

2022-12-20 Thread Jan Mercl
On Tue, Dec 20, 2022 at 9:21 AM Jason E. Aten wrote: > Shutting down goroutines quickly was needed so often that I wrote a package > to help me with it. it is called idem, short for idempotent. > > It uses the idea of an idempotent Close of a channel to signal that the > goroutine should stop.

Re: [go-nuts] Context cancellation: Is it sufficient to make long-running things interruptible?

2022-12-19 Thread Jan Mercl
On Mon, Dec 19, 2022 at 11:01 AM Torsten Bronger wrote: > The context documentation gives this example: > > // Stream generates values with DoSomething and sends them to out > // until DoSomething returns an error or ctx.Done is closed. > func Stream(ctx context.Context, out chan<-

Re: [go-nuts] Tool showing all assignemnts to the blank identifier

2022-11-28 Thread Jan Mercl
On Mon, Nov 28, 2022 at 1:44 PM Wojciech Muła wrote: > Is there any tool that would point out places with > an assignment to the blank identifier? > > I'd like to spot possible refactoring/debug leftovers, > like `_ := func() {}` or unused imports. > > I went through the staticcheck list of

Fwd: Re: [go-nuts] clarifying Go FAQ: Is Go an object-oriented language?

2022-11-22 Thread Jan Mercl
language? To: Jan Mercl <0xj...@gmail.com> I apologize for this automatic reply to your email. To control spam, I now allow incoming messages only from senders I have approved beforehand. If you would like to be added to my list of approved senders, please fill out the short request for

Re: [go-nuts] clarifying Go FAQ: Is Go an object-oriented language?

2022-11-22 Thread Jan Mercl
On Tue, Nov 22, 2022 at 4:43 PM Robert Engels wrote: > Go is not listed as an OO language on Wikipedia. Check https://en.wikipedia.org/wiki/Go_(programming_language): "ParadigmMulti-paradigm: concurrent imperative, object-oriented[1][2]" > Personally I think it is OO-like. OO typically has

Re: [go-nuts] Int64 to []byte and vice-versa

2022-11-21 Thread Jan Mercl
On Mon, Nov 21, 2022 at 9:57 AM Nikhilesh Susarla wrote: > I have an int64 value say 12 > I want to convert that to []byte array. Such conversion is not supported. Also, []byte is a slice. However, the desired result can be computed in code. You can use the encoding/binary package for that.

Re: [go-nuts] Module weirdness in playground

2022-11-18 Thread Jan Mercl
On Fri, Nov 18, 2022 at 7:15 PM Brian Candler wrote: > This used to work: > https://play.golang.org/p/YQoAu1Iwkor > > But now when I click on "Run", the import path of "example.com/myprog/foo" is > removed, and it fails to compile. > > Any clues as to what's going on? I think the playground

Re: [go-nuts] Is it possible to switch on type T in a generic function?

2022-11-08 Thread Jan Mercl
On Tue, Nov 8, 2022 at 10:56 AM 'Mark' via golang-nuts wrote: > // Want to sort by T < T // > elements := make([]string, 0, len(me)) > for element := range me { > elements = append(elements, fmt.Sprintf("%#v", element)) > } > sort.Strings(elements)

Re: [go-nuts] Is it possible to switch on type T in a generic function?

2022-11-08 Thread Jan Mercl
On Tue, Nov 8, 2022 at 9:53 AM 'Mark' via golang-nuts wrote: > Given a function: > > func F[T comparable](a T) { > } > > is it possible to check T's type inside F? > > My use case is that I have a function with signature G[T comparable](x []T) > and inside G I want to sort the elements in slice

Re: [go-nuts] Create a 1GB ballast but it takes up RSS and pages are Dirty?

2022-11-06 Thread Jan Mercl
On Sun, Nov 6, 2022 at 12:54 PM Kn (Kn) wrote: > Now the problem begins. I expect the ballast like `ballast := make([]byte, > 1<<30)` shouldn't take up any physical memory because there's no any writing > to it. The backing array is specified to be zeroed, so we cannot say there's no writing

Re: [go-nuts] Underscore symbol

2022-11-04 Thread Jan Mercl
On Fri, Nov 4, 2022 at 6:54 PM Canuto wrote: > I'm just starting out with go ... > I have searched for lights on this string but without success. > What does this sign mean " _, err " , what the underscore symbol means here ? > > func generateSalt() string { > randomBytes := make([]byte, 16) >

Re: [go-nuts] godoc and generic code

2022-11-03 Thread Jan Mercl
On Thu, Nov 3, 2022 at 12:49 PM Hotei wrote: > I added some generic code to a project and godoc doesn't seem to like that > and stops working when it sees the generics. It's a 4 year old version of > godoc so that's perhaps not a surprise. What is a surprise is that godoc > isn't shipped

Fwd: Re: [go-nuts] There is a passage in book that is difficult to understand, can anyone help explain it?

2022-11-02 Thread Jan Mercl
: Date: Wed, Nov 2, 2022 at 6:10 PM Subject: Re: Re: [go-nuts] There is a passage in book that is difficult to understand, can anyone help explain it? To: Jan Mercl <0xj...@gmail.com> I apologize for this automatic reply to your email. To control spam, I now allow incoming messages only from s

Re: [go-nuts] There is a passage in book that is difficult to understand, can anyone help explain it?

2022-11-02 Thread Jan Mercl
On Wed, Nov 2, 2022 at 5:35 PM Robert Engels wrote: > I think this can be disproven. > > Given a function A with a reentrant lock, it can be rewritten as A with > non-reentrant lock and A’ without a lock where A’ is the original A function > body. > > A’ would then be susceptible to the

Re: [go-nuts] How does the go compiler treat initialized string variables?

2022-11-01 Thread Jan Mercl
On Tue, Nov 1, 2022, 20:36 Frank Jüdes wrote: > I have to write a program that should verify the content of > configuration-servers. It will need a lot of pre-initialized data to verify > the actual content of a server, so it has to initialize many strings. What > i know from other C-style

Re: [go-nuts] Integration testing program that internally forks itself

2022-10-27 Thread Jan Mercl
Any recursion that does not have a terminating condition will try to recurse infinitely ;-) I'm passing a command line flag in such situations - when testing, but the best option depends on the particular use. Elsewhere, in a command that starts a server or talks to the server, I used, for

Re: [go-nuts] Occasional hard lockup w/ 100% CPU usage in go applications

2022-10-26 Thread Jan Mercl
On Wed, Oct 26, 2022 at 3:28 PM Steven Sokol wrote: > Currently running go 1.9.1, but I've been having this same issue since I > started working on this project about two years ago on 1.5.x. That version is 5 years old: https://go.dev/doc/devel/release#go1.9 Can you try a recent, supported

Re: [go-nuts] How to add zero after a decimal point in float datatype

2022-10-12 Thread Jan Mercl
On Wed, Oct 12, 2022 at 9:31 PM pravin chaudhary wrote: > I need to add zero after a decimal point to a float datatype but not able to > do. > > Required float value = 5.00 but getting as 5 > > Datatype should be float only!! > > Any help will be much appreciated! Is this perhaps what you're

Re: [go-nuts] Zero-sized data type

2022-10-12 Thread Jan Mercl
On Wed, Oct 12, 2022 at 6:01 PM Richiise Nugraha wrote: > Hi, I am looking for zero-sized data type, something like Flexible Array Member. > The size of `struct {}` is indeed zero, but for what reason when it's inside a struct with another member say (https://go.dev/play/p/DpydJIke7dS): > > type

Re: [go-nuts] workspace question

2022-10-12 Thread Jan Mercl
On Wed, Oct 12, 2022 at 4:49 AM Steve Roth wrote: > > I'd appreciate help with setting up a workspace, involving two modules that exist only on my local disk and not in any SCM. I understand how to create the workspace and use both modules in it. What I can't figure out is how to add a

Re: [go-nuts] int64(math.Inf(+1)) != math.MaxInt64

2022-10-03 Thread Jan Mercl
On Tue, Oct 4, 2022 at 4:18 AM Jonathan Pearson wrote: > I expected int64(math.Inf(+1)) == math.MaxInt64, but it does not. Quoting from https://go.dev/ref/spec#Conversions, section "Conversions between numeric types" In all non-constant conversions involving floating-point or complex

Re: [go-nuts] Struggling w/ use of a waitgroup

2022-10-02 Thread Jan Mercl
On Sun, Oct 2, 2022 at 7:36 PM Robert Solomon wrote: > https://go.dev/play/p/gIVVLsiTqod I believe wg.Add on line 125 is too late. I think it needs to be moved before the go statement on line 108. Not tested. -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Go routine context

2022-10-02 Thread Jan Mercl
On Sun, Oct 2, 2022 at 3:00 PM Robert Engels wrote: > They are still non-preemptive. Even the way preemption is implemented is > cooperative. Goroutines are preempted in a thread signal handler that invokes the Go runtime scheduler that in turn saves the required goroutine state and switches

Re: [go-nuts] Go routine context

2022-10-02 Thread Jan Mercl
On Sun, Oct 2, 2022 at 3:04 PM Robert Engels wrote: > One other thing, if you don’t think he knows exactly how Go routines are > implemented you are delusional. Maybe he should then fix the Wikipedia article I linked before. Good luck with that. PS: I assume you meant "goroutines" instead of

Re: [go-nuts] Go routine context

2022-10-02 Thread Jan Mercl
On Sun, Oct 2, 2022 at 2:47 PM Robert Engels wrote: > I already pointed that out.Go routines were non preemptive until recently. > They are also still non preemptive when calling a system call without direct > support, or CGo - it spins up another platform thread. I'm talking about a

Re: [go-nuts] Go routine context

2022-10-02 Thread Jan Mercl
On Sun, Oct 2, 2022 at 1:16 PM Robert Engels wrote: > By many definitions Go routines and virtual threads are technically > coroutines - versus a platform/OS thread. Show one please. Coroutines are normally a subject of non-preemptive multitasking, threads are normally just the opposite. [0]

Re: [go-nuts] Go routine context

2022-10-02 Thread Jan Mercl
On Sun, Oct 2, 2022 at 1:37 AM Robert Engels wrote: > I don’t see any arguments refuting the claim? Can you include a link so the > analysis can be read in context? The word "coroutines" does not ring a bell? -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Re: Question on 'cmd/compile: handle partially overlapping assignments' behavior on ARM64.

2022-09-20 Thread Jan Mercl
On Tue, Sep 20, 2022 at 6:02 PM peterGo wrote: > Yes, I read that too. A fundamental tenet of science is reproducibility. I > was able to reproduce the AMD64 results and documented it. A step forward. 5:24 PM (45 minutes ago) > I am unable to reproduce your results on AMD64. 6:02 PM (7 minutes

Re: [go-nuts] Re: Using golang variable in bash script Command

2022-09-19 Thread Jan Mercl
On Mon, Sep 19, 2022 at 2:52 PM Amnon wrote: > What happens if the user enters the string "'; rm -fr ~;'" ? https://twitter.com/codepo8/status/1373224835866882048 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

Re: [go-nuts] Using golang variable in bash script Command

2022-09-19 Thread Jan Mercl
On Mon, Sep 19, 2022 at 11:50 AM PK wrote: > search:=scanner.Text() > cmd1,err:=exec.Command("bash", "-c", "find . -name '*$search*'") Try something like this, not tested: cmd, err := exec.Command("bash", "-c", fmt.Sprintf("find . -name %s", search)) -- You received this message

Re: [go-nuts] Race detector question

2022-09-16 Thread Jan Mercl
On Fri, Sep 16, 2022 at 4:42 PM Robert Engels wrote: > I don’t know what is happening. The message you just sent came from you not > the list. This is not how it is supposed to work. That is why there is a > problem. FYI, I'm posting to the list from the GMail web client. This time I have

Re: [go-nuts] Race detector question

2022-09-16 Thread Jan Mercl
On Fri, Sep 16, 2022 at 4:23 PM Robert Engels wrote: > Normally when people reply to the list it only comes from the list - and the > list is allow listed. All people in this thread sent their replies to both you and the list. > You are the first person in years to say anything about this.

Fwd: Re: [go-nuts] Race detector question

2022-09-16 Thread Jan Mercl
a reply bot to spam my inbox, thank you. Otherwise I propose the admin of this list to ban your email. -- Forwarded message - From: Date: Fri, Sep 16, 2022 at 9:09 AM Subject: Re: Re: [go-nuts] Race detector question To: Jan Mercl <0xj...@gmail.com> I apo

Re: [go-nuts] Race detector question

2022-09-16 Thread Jan Mercl
On Fri, Sep 16, 2022 at 7:43 AM robert engels wrote: > After some analysis and discussion, the sample I provided earlier has a data > race by definition - although in many cases these are benign and do no affect > the correctness of the program. There's no such thing [in Go and many other

Re: [go-nuts] Is this a possible bug with pipe

2022-09-14 Thread Jan Mercl
On Thu, Sep 15, 2022 at 1:53 AM ramki...@hotmail.com wrote: > When I submitted it as a bug, this is what I got. > https://github.com/golang/go/issues/55029 By chance, do you know what is a > buffering for io.Copy? https://cs.opensource.google/go/go/+/refs/tags/go1.19.1:src/io/io.go;l=385

Re: [go-nuts] Is this a possible bug with pipe

2022-09-12 Thread Jan Mercl
On Mon, Sep 12, 2022 at 11:16 PM ramki...@hotmail.com wrote: > > I created a TCP Proxy using io.copy (which creates a splice). Here is the > code. > > Proxy TCP Server - https://pastebin.com/iAcFjmV1 > Regular TCP Server - https://pastebin.com/V6AN7atV > > When using telent to port 8080, the

Re: [go-nuts] Re: private go documentation server similar to https://pkg.go.dev

2022-09-12 Thread Jan Mercl
On Mon, Sep 12, 2022 at 10:01 AM brainman wrote: > I managed to run godoc. > > But godoc only displays standard library packages. > > Is it possible to configure godoc so it displays packages stored in private > github repos ? I use it with no configuration, '$ GO111MODULE=off godoc -http

Re: [go-nuts] Re: private go documentation server similar to https://pkg.go.dev

2022-09-11 Thread Jan Mercl
On Sun, Sep 11, 2022 at 4:20 AM Rob Pike wrote: > It would be nice if gofmt still had its -http option. You could run an > old version. AFAICT, the option is still there. We're using it at work, installed on our gitlab server. me@3900x:~$ go install -v

  1   2   3   4   5   6   7   8   9   10   >