[go-nuts] About code under the examples folder and lib module

2024-08-16 Thread Tong Sun
Hi, when providing a lib/module, would sample code under the `examples` folder be considered/linked as part of the module? I guess Go linker would be smart enough to not include them, as they all have their own `func main()` in them, but just want to clarify / confirm. I remember seeing one lib/m

Re: [go-nuts] GOEXPERIMENT source code build

2024-08-16 Thread Ian Lance Taylor
On Fri, Aug 16, 2024 at 7:28 AM Leah Stapleton wrote: > > I have a question about building go source code to run the tests go swiss > maps experiments. > > first off, > There are tests with the same name in map_swiss_test.go and > map_noswiss_test.go, and when I go test -run TestMapIterOrder, it

Re: [go-nuts] GOEXPERIMENT source code build

2024-08-16 Thread 'Michael Pratt' via golang-nuts
You can just set the environment variable, so `GOEXPERIMENT=swissmap go test`. On Fri, Aug 16, 2024 at 3:28 PM Leah Stapleton wrote: > Hi, > I have a question about building go source code to run the tests go swiss > maps experiments. > > first off, > There are tests with the same name in map_sw

[go-nuts] GOEXPERIMENT source code build

2024-08-16 Thread Leah Stapleton
Hi, I have a question about building go source code to run the tests go swiss maps experiments. first off, There are tests with the same name in map_swiss_test.go and map_noswiss_test.go, and when I *go test -run TestMapIterOrder, *it is by default running the test in map_noswiss_test.go, so

Re: [go-nuts] first class iterator values?

2024-08-16 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2024-08-16 at 12:09 +0200, 'Axel Wagner' via golang-nuts wrote: > Or with half the allocations: https://go.dev/play/p/LmtNdR-hfWY > I can't get it down to 1 allocation, which should be the theoretical > minimum, as I can't get the compiler to move the closure and the > state being closed ov

Re: [go-nuts] first class iterator values?

2024-08-16 Thread 'Axel Wagner' via golang-nuts
Or with half the allocations: https://go.dev/play/p/LmtNdR-hfWY I can't get it down to 1 allocation, which should be the theoretical minimum, as I can't get the compiler to move the closure and the state being closed over into one allocation. On Fri, 16 Aug 2024 at 11:43, Axel Wagner wrote: > Yo

Re: [go-nuts] first class iterator values?

2024-08-16 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2024-08-16 at 07:34 +, Costanza, Pascal wrote: > I haven’t double-checked, but according to the documentation of the > standard library, this should be possible: You can get an iterator > over a map from the maps package, and then convert it into a pull- > style iterator using the iter

Re: [go-nuts] first class iterator values?

2024-08-16 Thread 'Axel Wagner' via golang-nuts
You can also use reflect to get non-restartable map-iterators. It has some additional setup cost, but I don't think it's *a lot* and after that it should be relatively cheap. https://go.dev/play/p/vUec8AYhFPa On Fri, 16 Aug 2024 at 09:34, Costanza, Pascal wrote: > I haven’t double-checked, but a

Re: [go-nuts] first class iterator values?

2024-08-16 Thread Costanza, Pascal
I haven’t double-checked, but according to the documentation of the standard library, this should be possible: You can get an iterator over a map from the maps package, and then convert it into a pull-style iterator using the iter package. > On 16 Aug 2024, at 00:47, 'Dan Kortschak' via golang-

[go-nuts] Re: Programming patterns: storing runtime configuration

2024-08-16 Thread Jason E. Aten
I don't think its off topic. But: I don't really get a feel for the problem/challenge that you are facing, so its a little hard to try and help. Maybe unpacking the term "runtime config" would help. How is "runtime config" different from regular configuration files or structs? I do usually