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

2023-04-11 Thread tapi...@gmail.com
Not to mention that the change for "for;;" is so counter-intuitive and violates the try-to-be-explicit principle in Go. On Wednesday, April 12, 2023 at 9:08:24 AM UTC+8 tapi...@gmail.com wrote: > The plan for “for;;” is much more risky than “for-each”, because “for;;” > has more variation uses

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

2023-04-11 Thread tapi...@gmail.com
The plan for “for;;” is much more risky than “for-each”, because “for;;” has more variation uses in reality. I have no doubt that many non-bug compatibility-broken or performance-degradation cases will be found in the GOEXPERIMENT phase. On Saturday, March 25, 2023 at 2:44:59 PM UTC+8 Amnon

Re: [go-nuts] Map of Types is impossible, is there any alternative solution?

2023-04-11 Thread Rob Pike
I had written out a message to suggest this approach but deleted it because it still required a type switch afterwards. Later I realized that the variant types of the message could easily be handled by an interface, like this: type Message interface { Build([]byte) Message Handle() error }

Re: [go-nuts] Map of Types is impossible, is there any alternative solution?

2023-04-11 Thread burak serdar
You can do: var messageProcessors = map[uint8]func([]byte) Message { 0: processorForType0, 1: processorForType1, ... } Then: output:=messageProcessors[id](payload) Of course, with the appropriate error checks. On Tue, Apr 11, 2023 at 3:13 PM Bèrto ëd Sèra wrote: > I do know there's no

[go-nuts] Map of Types is impossible, is there any alternative solution?

2023-04-11 Thread Bèrto ëd Sèra
I do know there's no way to use var rule = map[uint8]Message{ 0: thisType, 1: thatType, 4: someOtherType, . } type Message interface { Become(data []byte) } type thisType struct { data []byte } func (my *thisType) Become(data []byte) { } type thatType struct {

[go-nuts] Map of types?

2023-04-11 Thread Bèrto ëd Sèra
Good evening, I do know there's no way to use var rule = map[uint8]interface{ 0: thisType, 1: thatType, 4: someOtherType, . } type Message interface { Become(data []byte) } type thisType struct { data []byte } func (my *thisType) Become(data []byte) { } type

[go-nuts] Re: [Contribution] Go_Updater shellscripting (GNU/Linux or WSL)

2023-04-11 Thread Brian Candler
Something to consider: if you untar over an existing installation, then it's possible you will be left with stale artefacts - e.g. source files that were in an old version that aren't in the new one. I've been bitten by this in other projects. I haven't been bitten by this in Go, but I always

Re: [go-nuts] Is there a golang download for latest patch release like 1.20.x?

2023-04-11 Thread Brian Candler
[Aside: I think it would have been better to start a new thread rather than hijack an unrelated conversation] go.dev and pkg.go.dev both work perfectly for me. Are you able to resolve those names to IP addresses - if so, what? What do you see when you attempt to connect? Do you have a static

[go-nuts] [Contribution] Go_Updater shellscripting (GNU/Linux or WSL)

2023-04-11 Thread Walddys Emmanuel Dorrejo Céspedes
hello, i did this Bash Script (only Linux/WSL) to update GoLang, it will give you some options, like update to the next patch (1.20.x) or the next minor version (1.21) only stable ones (not beta neither rc), if someone found useful, here is the link:

Re: [go-nuts] Is there a golang download for latest patch release like 1.20.x?

2023-04-11 Thread Fawaz Ibrahim
Hi . Apologies for intruding on the conversation.I think there is an issue with go.dev I have been trying to access the site for days but it's not responding On Thursday, March 30, 2023 at 7:48:25 PM UTC+1 Eli Lindsey wrote: > I’m not aware of a stable URL that always

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

2023-04-11 Thread 'Axel Wagner' via golang-nuts
FTR I have been using Go for 10 years and I certainly *have* read the spec - a lot, as you're well aware. I still occasionally make this mistake. Being able to explain *why* code is buggy doesn't prevent me from introducing a specific bug. On Tue, Apr 11, 2023, 10:54 Axel Wagner wrote: > > > On

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

2023-04-11 Thread 'Axel Wagner' via golang-nuts
On Tue, Apr 11, 2023, 09:15 Jan Mercl <0xj...@gmail.com> wrote: > 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 >

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 the plan? To: