Re: [go-nuts] Re: Exposing newcoro/coroswitch

2025-02-27 Thread Nuno Cruces
I may be missing something, but if your concern about passing the iterator to another goroutine, is with closing the wait channel here (which is indeed problematic), I think this change

Re: [go-nuts] Re: GC hint for collection timing

2025-02-27 Thread Robert Engels
One other note, it often works for large programs as well if you control the access pattern, as the OS will page out based on LRU so you can just keep allocating and never free… until you end. To make this work you sometimes need a special allocator so that old pages aren’t touched when allocating

[go-nuts] [security] golang.org/x/net fix pre-announcement

2025-02-27 Thread announce
Hello gophers, We plan to issue a security fix for the packages golang.org/x/net/proxy and golang.org/x/net/http/httpproxy in the golang.org/x/net module during US business hours on Tuesday, March 4. This will cover the following CVEs: - CVE-2025-22870 Following our security policy, thi

[go-nuts] [security] Go 1.24.1 and Go 1.23.7 pre-announcement

2025-02-27 Thread announce
Hello gophers, We plan to issue Go 1.24.1 and Go 1.23.7 during US business hours on Tuesday, March 4. These minor releases include PRIVATE security fixes to the standard library, covering the following CVE: - CVE-2025-22870 Following our security policy, this is the pre-announcement of

Re: [go-nuts] Re: GC hint for collection timing

2025-02-27 Thread Robert Engels
Btw this technique is common place for small utility programs - it is often harder to code the object life cycle in a complicated tree - so just don’t free until the process ends. Which is why GC is so beneficial for most programs. On Feb 27, 2025, at 5:47 PM, Robert Engels wrote:This is a perfec

Re: [go-nuts] Re: GC hint for collection timing

2025-02-27 Thread Robert Engels
This is a perfect case of weak references BUT these are still objects the GC needs to track, etc. A better solution for a compiler, is that if the original code did not need to free - and that was a substantial amount of the compiler garbage to make a difference - just run the compiler with GC turn

Re: [go-nuts] Re: GC hint for collection timing

2025-02-27 Thread Will Faught
>GOMEMLIMIT (https://go.dev/doc/gc-guide#Memory_limit) applies this idea to all allocations. (GC doesn't need to run if there is lots of headroom). Isn't that only useful if there's a limit, and you know what it is? That isn't the case for the Go command in general. >I'm not sure I understand the

[go-nuts] "gopkg.in/yaml.v2" package silently misparses file that is misformatted

2025-02-27 Thread David Karr
I wrote some code to load a yaml file and do some work with the resulting data. I'm using the "gopkg.in/yaml.v2" package for it. This has been working fine for properly formatted YAML. However, today I discovered that a slightly misformatted YAML file is being happily loaded by this code, wi

Re: [go-nuts] Re: GC hint for collection timing

2025-02-27 Thread 'Michael Pratt' via golang-nuts
On Thu, Feb 27, 2025 at 5:56 PM Amnon wrote: > Go nearly had Arenas a few years ago. And I think they are still used in > Google. > But they were pulled because the polluted the API's of too many libraries. > See https://github.com/golang/go/issues/51317 > On Thursday, 27 February 2025 at 07:55:2

[go-nuts] Re: GC hint for collection timing

2025-02-27 Thread Amnon
Go nearly had Arenas a few years ago. And I think they are still used in Google. But they were pulled because the polluted the API's of too many libraries. See https://github.com/golang/go/issues/51317 On Thursday, 27 February 2025 at 07:55:27 UTC will@gmail.com wrote: > I recently recalled t

Re: [go-nuts] Why can't single-method interfaces not be implemented by embedding?

2025-02-27 Thread 'Axel Wagner' via golang-nuts
Just to quote the spec to clarify, perhaps: > A field or method f of an embedded field in a struct x is called promoted if x.f is a legal selector that denotes that field or method f So there are two conditions for a method to be promoted: 1. it must be a le

Re: [go-nuts] Why can't single-method interfaces not be implemented by embedding?

2025-02-27 Thread Ian Lance Taylor
On Thu, Feb 27, 2025 at 9:49 AM cpu...@gmail.com wrote: > > Thanks Ian, you are of course correct- but I still don't get it. Thank you > for taking the time. > > > m.EqualName has to mean something. The Go language defines it as > meaning the field in m's type, rather than the embedded method. >

Re: [go-nuts] suggested change to template.Funcs docstring

2025-02-27 Thread Ian Lance Taylor
On Thu, Feb 27, 2025 at 1:04 PM Rory Campbell-Lange wrote: > > The docstring for [html|text]/template.Funcs is as follows > > package template // import "html/template" > > func (t *Template) Funcs(funcMap FuncMap) *Template > Funcs adds the elements of the argument map to the temp

[go-nuts] [security] golang Firestore SIGSEGV

2025-02-27 Thread David
___ # go run sigsegv.go panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa68a44] goroutine 1 [running]: cloud.google.com/go/firestore.(*Client).Close(...) /root/go/pkg/mod/cloud.googl

Re: [go-nuts] Why can't single-method interfaces not be implemented by embedding?

2025-02-27 Thread Ian Lance Taylor
On Thu, Feb 27, 2025 at 9:32 AM cpu...@gmail.com wrote: > > I can see that that's the difference and cause but I'm not convinced by the > explanation (although that clearly is what happens): > > If the embedded method name EqualName shadows the method name EqualName that > should still implement

Re: [go-nuts] Why can't single-method interfaces not be implemented by embedding?

2025-02-27 Thread cpu...@gmail.com
I can see that that's the difference and cause but I'm not convinced by the explanation (although that clearly is what happens): If the embedded method name EqualName shadows the method name EqualName that should still implement the interface of the same signature? I.e. why doesn't the shadow i

Re: [go-nuts] Why can't single-method interfaces not be implemented by embedding?

2025-02-27 Thread 'Ian Cottrell' via golang-nuts
It's because your method and field have the same name, if you rename the interface to SameNamer (and thus rename the field as well) it will work. On Thu, Feb 27, 2025 at 12:07 PM cpu...@gmail.com wrote: > About every single time I feel like I understand Go interfaces I'm being > taught different

Re: [go-nuts] Why can't single-method interfaces not be implemented by embedding?

2025-02-27 Thread cpu...@gmail.com
Thanks Ian, you are of course correct- but I still don't get it. Thank you for taking the time. > m.EqualName has to mean something. The Go language defines it as meaning the field in m's type, rather than the embedded method. Doesn't have meter an embedded field of type EqualName (the interface

Re: [go-nuts] [security] golang Firestore SIGSEGV

2025-02-27 Thread Ian Lance Taylor
On Thu, Feb 27, 2025 at 9:22 AM David wrote: > > ___ > # go run sigsegv.go > panic: runtime error: invalid memory address or nil pointer dereference > [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa68a44] > > goroutine 1 [running]: > cloud.google.com/go

Re: [go-nuts] Why can't single-method interfaces not be implemented by embedding?

2025-02-27 Thread burak serdar
The embedded name `EqualName` shahows the method called `EqualName`. Rename the `EqualName` interface to `EqualNamer`, and things work. On Thu, Feb 27, 2025 at 10:07 AM cpu...@gmail.com wrote: > > About every single time I feel like I understand Go interfaces I'm being > taught differently. >

[go-nuts] Why can't single-method interfaces not be implemented by embedding?

2025-02-27 Thread cpu...@gmail.com
About every single time I feel like I understand Go interfaces I'm being taught differently. Consider this play: https://play.golang.com/p/qeF4KvaPcwp There are 2 single method interfaces. One where interface and method names are equal, one where they are different. I would have expected m to