Re: [go-nuts] Using struct{} for context keys

2023-05-29 Thread Andreas Götz
Thank you. Zero values are of course identical. I was only thinking about the pointer case... On Sunday, May 28, 2023 at 5:10:33 PM UTC+2 burak serdar wrote: > Two values A and B are equal (A==B) if A and B have the same type and the > same values. In a code where > > a:=clientContextKey{} >

Re: [go-nuts] gofmt: expected declaration, found ')'

2023-04-16 Thread Andreas Götz
Sunday! On Sunday, April 16, 2023 at 1:02:31 PM UTC+2 Jan Mercl wrote: > 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

Re: [go-nuts] gofmt: expected declaration, found ')'

2023-04-16 Thread Andreas Götz
ossible that's too old? I don't know why that would matter here, > though, the code doesn't seem to be using any new language features. > > On Sun, Apr 16, 2023 at 12:34 PM Andreas Götz wrote: > >> The entire file is >> https://raw.githubusercontent.com/evcc

Re: [go-nuts] gofmt: expected declaration, found ')'

2023-04-16 Thread Andreas Götz
://go.dev/play/p/XhoSAFjpGXa On Sunday, April 16, 2023 at 12:31:22 PM UTC+2 Jan Mercl wrote: > 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 t

[go-nuts] gofmt: expected declaration, found ')'

2023-04-16 Thread Andreas Götz
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 using a "porcelain" step to make sure only go-fmt'ed sources are ch

[go-nuts] Re: Drain channel on demand without busy looping?

2023-02-08 Thread Andreas Götz
Thanks Jason, that is absolutely beautiful. Ranging over channel wont work when the channel remains open (my case), but the "callback" pattern is really nice. Much appreciated, Andi On Wednesday, February 8, 2023 at 2:38:28 AM UTC+1 Jason E. Aten wrote: > > I have the requirement of make sure

[go-nuts] Re: Error-checking with errors.As() is brittle with regards to plain vs pointer types

2022-09-22 Thread Andreas Götz
That is a *very* good point. It still seems more obvious that one would check for error instead of pointer to error. If we don't want to do this as part of errors.As (or cannot) it might make sense for golangci-lint. I'm seeing that plain errors is a quite popular pattern? On Thursday, Septembe

Re: [go-nuts] encoding/asn1 overly strict?

2022-06-10 Thread Andreas Götz
On Thursday, June 9, 2022 at 6:44:58 PM UTC+2 Brian Candler wrote: > I forgot to add one thing, and you didn't paste the whole certificate PEM > so I can't check this. > > Recent versions of Go won't verify the certificate unless it contains a > subjectAltName; matching against only the CN is no

Re: [go-nuts] encoding/asn1 overly strict?

2022-06-08 Thread Andreas Götz
To be more specific: in order to connect to the IOT server presenting the rogue BER certificate, we have InsecureSkipVerify: true. The description of InsecureSkipVerify reads: // InsecureSkipVerify controls whether a client verifies the server's // certificate chain and host name. If InsecureSki

[go-nuts] Re: What are best practices for synchronizing data access in web applications?

2022-03-01 Thread Andreas Götz
> I would ask what is the shared resource that you're synchronizing access to. The resource is really the internal program state. It's a steering mechanism controlled by various parameters (mode, timings etc) that need be synchronized to avoid races. > I recommend you watch and digest "Rethi

[go-nuts] Re: How to diagnose a stuck program

2021-11-06 Thread Andreas Götz
Sorry if the question was stupid. Happened to find https://stackoverflow.com/questions/42238695/goroutine-in-io-wait-state-for-long-time and looking at pprof profile right now. On Saturday, November 6, 2021 at 10:59:26 AM UTC+1 cpu...@gmail.com wrote: > Developing https://github.com/evcc-io/e

Re: [go-nuts] http.Response.Body.Close when ignoring the resp

2021-08-06 Thread Andreas Götz
Replying here as I was thinking about suggesting a go/vet check if the body is actually being closed. What I realise now is, that closing the body is just as good as not closing it as long as one doesn't read it first. As for reading there is probably a trade-off on when actually reading is st

Re: [go-nuts] How to use errors.As with sentinel errors?

2021-08-04 Thread Andreas Götz
Opened https://github.com/golang/go/issues/47528 On Monday, August 2, 2021 at 6:30:04 PM UTC+2 Andreas Götz wrote: > > Because both are of type `*errors.errorString`, so the types match and > it copies over the value. > Arguably, `errors.errorString` should implement `As()` and r

Re: [go-nuts] How to use errors.As with sentinel errors?

2021-08-02 Thread Andreas Götz
> Because both are of type `*errors.errorString`, so the types match and it copies over the value. Arguably, `errors.errorString` should implement `As()` and return `false`, unless the pointers match. I suggest filing an issue. Will do. It could also be a vet check to highlight errors.As used on