Re: [go-nuts] Adding methods to non local types that use more state than available in the non local type

2025-05-11 Thread 'Axel Wagner' via golang-nuts
On Mon, 12 May 2025 at 07:05, Axel Wagner wrote: > A less evil, but still bad way, would be to store it in a global map: > https://go.dev/play/p/ZHBJVCduf25 (note: I'm not sure this use of weak > pointers is actually correct, I haven't used them yet). > Okay, I'm pretty sure it's not correct. It

Re: [go-nuts] Adding methods to non local types that use more state than available in the non local type

2025-05-11 Thread 'Axel Wagner' via golang-nuts
On Mon, 12 May 2025 at 00:25, Alexander Shopov wrote: > I cannot just make *EnrichedResponse* a struct embedding > *generated.Response *and add more state because then I cannot do the > conversion from normal response to enriched. > Why does this have to be a conversion? What's the downside of h

Re: [go-nuts] Adding methods to non local types that use more state than available in the non local type

2025-05-11 Thread Robert Engels
If you look at the example given the function accepts the base type and then tries to call the function needing the extended type - pretty sure you can’t do this with embedding as the type is erased when the outer function is called. You need an interface afaik. On May 11, 2025, at 8:43 PM, Jason E

Re: [go-nuts] Adding methods to non local types that use more state than available in the non local type

2025-05-11 Thread Jason E. Aten
I think you have just misunderstood how to embed types in Go, because you say *> // Declare a new type that embeds the generated.Response> type EnrichedResponse generated.Response* and this is not type embedding, it is just a type definition, giving a new name and new type for the existing st

Re: [go-nuts] net/icmp: Echo.ID and Echo.Seq are defined as int, but Marshal converts them to uint16

2025-05-11 Thread Ian Lance Taylor
On Sun, May 11, 2025 at 8:59 AM Yuen Sun wrote: > > I believe changing the types of ID and Seq to uint16 would make the > implementation more consistent with the ICMP protocol specification. > Understanding the original design intent would also help the community better > align with Go's design

[go-nuts] Adding methods to non local types that use more state than available in the non local type

2025-05-11 Thread Alexander Shopov
Hi all, I need some guidance whether what I want to do is somehow possible in Go. I've already searched answers for two days. My problem boils down to how to sneak more in a type without changing the type. Lets say I have to implement the following method: *func (s *server) Get(ctx context.

Re: [go-nuts] Trying to port Go to HPE NonStop x86 - Need some guidance

2025-05-11 Thread Steven Meadows
Where are at with this port to Nonstop On Thursday, June 10, 2021 at 7:24:39 PM UTC-4 Ian Lance Taylor wrote: > On Wed, Jun 9, 2021 at 6:16 AM Shiva wrote: > > > > I have now duped all of the linux files and created nsx variants, I've > also set the environment variables GOOS to nsx and GOARCH

[go-nuts] Re: net/icmp: Echo.ID and Echo.Seq are defined as int, but Marshal converts them to uint16

2025-05-11 Thread Jason E. Aten
Hi Yuen Sun, Your question is a fine one, but better directed to the Go development team than to general users of Go. If its going to be fixed, it will need issue anyway, so I suggest simply filing an issue and/or asking on golang-dev. https://github.com/golang/go/issues https://groups.google.com

Re: [go-nuts] Re: [security] Go 1.24.3 and Go 1.23.9 are released

2025-05-11 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2025-05-11 at 13:30 +, 'Eric Jacksch' via golang-nuts wrote: > > > How to build go from source The instructions at https://go.dev/doc/install/source should help with this. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubsc

Re: [go-nuts] Re: Goroutines and channels optimization

2025-05-11 Thread Kanak Bhatia
Thanks, I'll check it out. On Sun, 11 May 2025, 22:44 Robert Engels, wrote: >  > This seems to be a decent meta reference > https://www.linkedin.com/advice/0/what-key-skills-tools-cloud-performance-tuning?utm_source=share&utm_medium=member_ios&utm_campaign=share_via#:~:text=Cloud%20performance%

Re: [go-nuts] Re: Goroutines and channels optimization

2025-05-11 Thread Kanak Bhatia
Thanks for the tip! Could you suggest some resources for the same regarding these design considerations if you know of any ? On Sun, 11 May 2025, 21:48 Robert Engels, wrote: > Of that I’m not sure. It is based on deep knowledge of how these things > are built from the hardware to the kernel to

Re: [go-nuts] Re: Goroutines and channels optimization

2025-05-11 Thread Robert Engels
Of that I’m not sure. It is based on deep knowledge of how these things are built from the hardware to the kernel to network protocols to the service layers. It broadly falls under performance tuning of which there is lots of literature. The key element of how channels and go routines play into thi

Re: [go-nuts] Re: Goroutines and channels optimization

2025-05-11 Thread Kanak Bhatia
Does we have any kind of documented material or mathematical theory type stuff for these things or is it more like hit or try On Sun, 11 May 2025, 08:04 ren...@ix.netcom.com, wrote: > The two most likely limiters in performance will be your network pipe to > the cloud and the QPS quota offered b

[go-nuts] Re: [security] Go 1.24.3 and Go 1.23.9 are released

2025-05-11 Thread 'Eric Jacksch' via golang-nuts
How to build go from source -- Eric Jacksch, CPP, CISM, CISA, CISSP President and Principal Consultant e...@tenebris.com +1.613.454.8200 From: golang-annou...@googlegroups.com on behalf of Cherry Mui Sent: Tuesday, May 6, 2025 2:48:08 PM To: golang-nuts@google

[go-nuts] net/icmp: Echo.ID and Echo.Seq are defined as int, but Marshal converts them to uint16

2025-05-11 Thread Yuen Sun
Description In the Go net/icmp package, the ID and Seq fields of the Echo struct are defined as int types. However, in the Marshal method, these fields are cast to uint16. This can lead to data truncation if the values of ID or Seq exceed the 16-bit range. // An Echo represents an ICMP echo req

Re: [go-nuts] single instance of package/mutex in a build?

2025-05-11 Thread Robert Engels
Yes, what Axel said is what I was referring to - with the last clause in the affirmative that I don’t consider them the same package. But using a stable third package to enforce a single instance works and is what I would do. On May 11, 2025, at 3:23 AM, Jason E. Aten wrote:Thanks for the reply,

Re: [go-nuts] single instance of package/mutex in a build?

2025-05-11 Thread Jason E. Aten
Thanks for the reply, Robert. I had thought, mistakenly that v1.6 and v1.7, of v0.8 and v1.0 might collide, and I was concerned about having multiple instances of a what should be a global mutex. But it turns out, when I tested this, and as Axel kindly pointed out, the module system will alway

Re: [go-nuts] single instance of package/mutex in a build?

2025-05-11 Thread Jason E. Aten
Excellent. Thank you, Axel, for the full briefing, and backstory, and especially the advice to use a very stable internal style package to pro-actively avoid the situation. I'll close out that ticket. On Sunday, May 11, 2025 at 8:07:50 AM UTC+1 Axel Wagner wrote: > The only case where you can re

Re: [go-nuts] single instance of package/mutex in a build?

2025-05-11 Thread 'Axel Wagner' via golang-nuts
The only case where you can reasonably say that there are "two versions of the same package" in a build, is if they are in different major versions of the same module¹, say example.com/foo/v2 and example.com/foo/v3. In that context, you have control over both versions. You can guarantee that they u