Re: [go-nuts] Use a hash/maphash uint64 as map key

2025-06-26 Thread Jan Mercl
On Thu, Jun 26, 2025 at 9:12 AM Robert Engels wrote: > Because the stdlib generic map is not 1) an interface (e.g. cannot have > concurrent semantics with same syntax ) and 2) cannot work with arbitrary > types - they must implement comparable. I quoted a sentence with a complain about the lac

Re: [go-nuts] Use a hash/maphash uint64 as map key

2025-06-25 Thread Jan Mercl
On Thu, Jun 26, 2025 at 8:30 AM Robert Engels wrote: > Agreed. I’ve been away from Go for a bit - I just assumed with hash/maphash > the stdlib had a generic map… ugh. Why should the _stdlib_ have a generic map when the _language_ had a generic map since it went public in 2009? -- You receive

Re: [go-nuts] atal error: all goroutines are asleep - deadlock!

2025-05-22 Thread Jan Mercl
On Thu, May 22, 2025 at 10:15 AM natxo@gmail.com wrote: > fatal error: all goroutines are asleep - deadlock! Something like this? https://go.dev/play/p/4mWJOZd9hgz -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this gr

Re: [go-nuts] Re: Why this compilation error ?

2025-03-17 Thread Jan Mercl
On Mon, Mar 17, 2025 at 9:45 AM tapi...@gmail.com wrote: > You can use *new(Version) instead of Version{} to avoid parsing ambiguity. FTR: This would never pass my review. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from thi

Re: [go-nuts] Why this compilation error ?

2025-03-16 Thread Jan Mercl
On Sun, Mar 16, 2025 at 2:30 PM 'Christophe Meessen' via golang-nuts wrote: > You'll find the minimal example code generating the compilation error > here: https://go.dev/play/p/Vb-dNr2DpzM > > It is easy to get around it as the example shows. Why is the compiler > considering this as an error ?

Re: [go-nuts] Why does this channel-based pub/sub broker panic?

2025-03-04 Thread Jan Mercl
On Tue, Mar 4, 2025 at 2:55 PM cpu...@gmail.com wrote: > Thanks Jan, but this just confirms that there is a send on a closed channel. It shows the code is "actively" closing a channel that will be later used for sending. Meaning the problem is possibly not in the send, but in the close. -- You

Re: [go-nuts] Why does this channel-based pub/sub broker panic?

2025-03-04 Thread Jan Mercl
On Tue, Mar 4, 2025 at 2:41 PM cpu...@gmail.com wrote: > I've recently run across > https://stackoverflow.com/questions/36417199/how-to-broadcast-message-using-channel > by icza and tried to use the simple broker in my project. > > Unfortunately, it panics with send on closed channel. I couldn

Re: [go-nuts] Analyzing goroutine heap allocations (leak)

2025-02-24 Thread Jan Mercl
On Mon, Feb 24, 2025 at 9:20 AM Gavra wrote: > I am not sure I understand. I have the issue reproducing only in production > on a running instance... Not mentioned in the OP. You can still try to write tests and/or benchmarks that exhibit the same memory leak and then use them with the -memprof

Re: [go-nuts] Analyzing goroutine heap allocations (leak)

2025-02-23 Thread Jan Mercl
On Sun, Feb 23, 2025 at 1:12 PM Gavra wrote: > I have a heap profile that shows that many allocations are generated in a function that runs in a go routine. Unfortunately, I can't see the caller(s) to this function, implying I cannot detect the one holding the reference (and causing the mem leak)

Re: [go-nuts] why url.Parse return err=nil with an apparently invalid URL

2025-02-20 Thread Jan Mercl
On Thu, Feb 20, 2025 at 1:06 PM Lin Lin wrote: > I think that's a little conflict with Go's convention. If the error is nil, one can be sure any returned Object is good. In this case, how can the caller trust the result? Or we can improve the doc to explain a bit more. I believe most Go developers

Re: [go-nuts] Trying to write a web scraper that checks dead links on a webapge

2025-02-13 Thread Jan Mercl
On Thu, Feb 13, 2025 at 2:30 PM Dennis Lee wrote: > I use: > - go version go1.22.3 windows/amd64 Too old Go version, see https://tip.golang.org/doc/go1.23 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] Trying to define generic methods to access a memory cache

2025-02-12 Thread Jan Mercl
On Wed, Feb 12, 2025 at 11:34 PM David Karr wrote: > > Ok, good to know. How do I solve this problem? It almost looks like I have to > create a slice of the generic type and iterate through the entries in the > commitsCache result, doing a type conversion of every entry. I don't know what probl

Re: [go-nuts] Trying to define generic methods to access a memory cache

2025-02-12 Thread Jan Mercl
On Wed, Feb 12, 2025 at 10:54 PM David Karr wrote: `[]any` is a slice type (https://go.dev/ref/spec#Slice_types), not an interface type (https://go.dev/ref/spec#Interface_types). But type assertions, as in `expr.(someType)`, are valid only for interface types: https://go.dev/ref/spec#Type_assert

Re: [go-nuts] Fscan() eats 1st char in scanning values

2025-01-27 Thread Jan Mercl
On Mon, Jan 27, 2025 at 6:54 PM 'Ivan Burak' via golang-nuts wrote: WAI: https://go.dev/play/p/4bWHGemItL_9 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to gola

Re: [go-nuts] how to get dirt memory in go

2025-01-14 Thread Jan Mercl
On Tue, Jan 14, 2025 at 2:44 PM Vasiliy Tolstov wrote: > Hi! I'm try to search answers but have no luck. In go i can create > memory arena/ buffer pool etc.. > But does it possible to get memory with like make([]byte, XXX) but > without calloc for this memory? Not sure if it's what you're after,

Re: [go-nuts] GoImports version

2024-10-18 Thread Jan Mercl
On Fri, Oct 18, 2024 at 9:17 AM 'Axel Wagner' via golang-nuts wrote: > I tried it out and the format parsed by debug.ParseBuildInfo is almost > exactly what is output by go version -m: > https://go.dev/play/p/L-MNzr0EnjV > (and yes, my goimports version is old) And https://go.dev/play/p/bgeGr2h

Re: [go-nuts] [ANN] tk9.0: The CGo-free, cross platform GUI toolkit for Go

2024-10-14 Thread Jan Mercl
On Mon, Oct 14, 2024 at 9:28 PM robert engels wrote: > This what it look like… it transpiles the libX library (on linux and osx > anyway), in order to bind to the X Window system. darwin/macOS is supported by the purego project and on that target Tcl/Tk uses Aqua, not XQuartz(X11) for the GUI.

Re: [go-nuts] Re: [ANN] tk9.0: The CGo-free, cross platform GUI toolkit for Go

2024-10-14 Thread Jan Mercl
On Mon, Oct 14, 2024 at 9:16 PM 'Brian Candler' via golang-nuts wrote: > Or it could be like https://pkg.go.dev/modernc.org/sqlite, which took the > Sqlite C source code and transpiled it into pure Go. It's both, depending on target. The targets supported by ebitengine/purego[0] link dynamicall

Re: [go-nuts] Alignment guarantees of heap allocations

2024-10-10 Thread Jan Mercl
On Thu, Oct 10, 2024 at 2:23 PM 'Timo Beckers' via golang-nuts wrote: > I've been searching around for some info or existing conversations around > this topic, but that hasn't turned up anything useful so far. I had a > question around some implicit behaviour of Go's heap allocator. >From the

Re: [go-nuts] Re: [ANN] tk9.0: The CGo-free, cross platform GUI toolkit for Go

2024-10-02 Thread Jan Mercl
On Wed, Oct 2, 2024 at 3:07 PM Mandolyte wrote: > What did I do wrong? Copying the go.mod file effectively declares the code in hello.go to be in package modernc.org/tk9.0. That's the package hello.go imports, hence the import cycle. This works here: jnml@t3610:~/tmp$ mkdir tk jnml@t3610:~/tmp$

Re: [go-nuts] [ANN] tk9.0: The CGo-free, cross platform GUI toolkit for Go

2024-09-28 Thread Jan Mercl
On Sat, Sep 28, 2024 at 10:09 PM 'Brian Candler' via golang-nuts wrote: > Aside: on front page: "Viewing this on go.pkg.dev?" > > Actually I was viewing it on pkg.go.dev :-) Thanks to D. Honnef on Slack for revealing to me the [invisible to me] difference between go.pkg.dev and pkg.go.dev. Fix c

Re: [go-nuts] [ANN] tk9.0: The CGo-free, cross platform GUI toolkit for Go

2024-09-28 Thread Jan Mercl
On Sat, Sep 28, 2024 at 10:09 PM 'Brian Candler' via golang-nuts wrote: > Aside: on front page: "Viewing this on go.pkg.dev?" > > Actually I was viewing it on pkg.go.dev :-) The text in the picture tries to nudge you into expanding the README.md section on go.pkg.dev, where it is collapsed by de

[go-nuts] [ANN] tk9.0: The CGo-free, cross platform GUI toolkit for Go

2024-09-28 Thread Jan Mercl
http://modernc.org/tk9.0 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https

Re: [go-nuts] Perplexing error

2024-09-09 Thread Jan Mercl
On Mon, Sep 9, 2024 at 9:24 PM P Padil wrote: > Can someone please explain to me why the following doesn’t work: > > slices.SortFunc(ilps, func(u, w *big.Int) int { return u.Cmp(w) }) > > I get: > slices.SortFunc(ilps, (func(u, w *big.Int) int literal)) (no value) used as > value Providing a co

Re: [go-nuts] Suppress GoFmt-generated error with/tools.go?

2024-08-31 Thread Jan Mercl
On Sat, Aug 31, 2024 at 2:22 PM Mike Schinkel wrote: > go fmt ./tools.go 'go fmt' is not gofmt. The OP talks about gofmt. I haven't tried anything but you may try if using gofmt instead of 'go fmt' makes a difference. -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Imitating tuple in golang

2024-08-08 Thread Jan Mercl
On Thu, Aug 8, 2024 at 9:35 PM 'lijh8' via golang-nuts wrote: > I try to use slice of any to imitate the tuple type, > and use this function to compare two slices: a, b. > > How can I improve it? Take a look at https://pkg.go.dev/slices#Compare if it can fit your use case. -- You received this

Re: [go-nuts] this code sometimes hangs

2024-07-18 Thread Jan Mercl
On Thu, Jul 18, 2024 at 4:24 PM Lammie Jonson wrote: > goroutineRunning.Done() Should be defer goroutineRunning.Done() (not tested) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop rece

Re: [go-nuts] Importing non-module based code

2024-07-16 Thread Jan Mercl
On Tue, Jul 16, 2024 at 3:57 PM Robert Engels wrote: > Yes, I just added that tag and pushed it, but @latest wouldn’t pick it up for > some reason, needed to specify the release exactly using @v0.3.1 @latest is the "latest" known to the proxy server. It has some varying delay to update. -- Yo

Re: [go-nuts] Importing non-module based code

2024-07-16 Thread Jan Mercl
On Tue, Jul 16, 2024 at 3:50 PM Robert Engels wrote: > > Weird, even after I added the tag, using @latest did not pull the latest > code, I needed to specify the tag specifically @v0.3.1 I think I see the exported identifiers you need in v0.3.1, published 2018: https://pkg.go.dev/github.com/rob

Re: [go-nuts] Importing non-module based code

2024-07-16 Thread Jan Mercl
On Tue, Jul 16, 2024 at 3:41 PM 'Robert Engels' via golang-nuts wrote: > The go get works, and the code is there, but it isn’t seeing my code - it > seems like it is using the original gocui which has since added module > support. > > cmd/client/main.go:43:7: gui.Update undefined (type *gocui.G

Re: [go-nuts] Benchmark "overall" operation

2024-07-08 Thread Jan Mercl
On Mon, Jul 8, 2024 at 10:36 PM Robert Engels wrote: > Is there anyway to do what I want? The usual way is to factor out any parts that can skew the results before the benchmark loop and call b.ResetTimer() just before entering the 'for i := 0; i < b.N; i++ {' loop. > If not, maybe a useful add

Re: [go-nuts] Benchmark "overall" operation

2024-07-08 Thread Jan Mercl
On Mon, Jul 8, 2024 at 10:08 PM 'Robert Engels' via golang-nuts wrote: > Given this code (which I know is not “correct”): Setting b.N in the benchmark code has no specified behavior. The actual behavior at the moment ignores such changes. The algorithm used by the testing package adjusts b.N in

Re: [go-nuts] Does data race with only multiple goroutine parallel i=1 have an impact on the execution results?

2024-07-06 Thread Jan Mercl
On Sat, Jul 6, 2024 at 5:21 PM Robert Engels wrote: > That is not a data race. The wait group is a synchronization barrier. Multiple concurrent, uncoordinated writers are a perfect data race. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread Jan Mercl
On Thu, Jun 20, 2024 at 1:26 PM 'Axel Wagner' via golang-nuts wrote: > (apologies for the abundance of grammatical and spelling errors that occurred > during editing and of course only became visible after hitting "send") (Send collapses the wave function ;-) -- You received this message bec

Re: [go-nuts] Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread Jan Mercl
On Thu, Jun 20, 2024 at 1:16 PM Oliver Eikemeier wrote: > • Pointer types are comparable. Two pointer values are equal if they point to > the same variable or if both have value nil. Pointers to distinct zero-size > variables may or may not be equal. Compare to (made up) "NaNs always compare n

Re: [go-nuts] Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread Jan Mercl
On Thu, Jun 20, 2024 at 12:28 PM Oliver Eikemeier wrote: > It mentions “pointers” (plural) to zero-sized variables, but for this > behavior it is sufficient when only one pointer derives from a pointer to a > zero-sized variable, as demonstrated in the example below. The plural is there becaus

Re: [go-nuts] Symbol of const string are not exported by compiler

2024-05-30 Thread Jan Mercl
On Thu, May 30, 2024 at 10:34 AM Benoît Marguerie wrote: > I discovered a "strange" behavior doing a simple operation. > I defined 2 const : one integer and one string. With delve (or other > debugger), I'm able to consult the const integer value but not the const > string value. Delve team exp

Re: [go-nuts] encoding/asn1 I can't Marshal a struct with pointer members

2024-04-27 Thread Jan Mercl
On Sun, Apr 28, 2024, 03:03 J Liu <8859210...@gmail.com> wrote: > My program is like this: > > type Girl struct { > Name string > Age int > } > > type Person struct { > girl *Girl > job string > } > > > What should I do to Marshal 'Person'? > I think you need to export th

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 > signature

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" gr

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 "golang-

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 value

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): > https://stackoverflow.com/questions/77802102/mutex-and-condition-variables-in-go-without-using-the-sync-

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 beca

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 gor

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 "br

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 becau

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 [most

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 compi

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 d

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 i

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 root

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 instal

Re: [go-nuts] How ignore a subdirectory

2023-09-12 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 unsubscrib

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 stop

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 sub

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 a

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 this

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 mes

[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 d

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. > > https://twitter.com/bradfitz/status/8552718671

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 Desi

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 tha

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 b

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 subscr

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 s

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 = (m

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, "Somethin

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 = &p > t.Error("hello") > } > > Here is the stack trac

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 demonstrat

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] https://www.google.com/search?q=define+overwhelm

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 > which

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: > > fun

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

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 obta

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 thing

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 us

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 t

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 w

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 (v

[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 receivin

[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 u

  1   2   3   4   5   6   7   8   9   10   >