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

2021-08-02 Thread cpu...@gmail.com
Consider this example: https://play.golang.org/p/16cU0kc8Lku, basically var Err = errors.New("sentinel") err := errors.New("foo") if errors.As(err, &Err) { fmt.Println("why?") } I'm wondering why this matches the sentinel error, or rather how to properly use sentinel errors. errors.As says "An

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

2021-08-02 Thread cpu...@gmail.com
Ah, think I found it: https://blog.golang.org/go1.13-errors says: In the simplest case, the errors.Is function behaves like a comparison to a sentinel error, and the errors.Asfunction behaves like a type assertion. When operating on wrapped errors, however, these functions consider all the erro

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

2021-08-02 Thread 'Axel Wagner' via golang-nuts
On Mon, Aug 2, 2021 at 10:02 AM cpu...@gmail.com wrote: > Consider this example: https://play.golang.org/p/16cU0kc8Lku, basically > > var Err = errors.New("sentinel") > err := errors.New("foo") > if errors.As(err, &Err) { > fmt.Println("why?") > } > > I'm wondering why this matches the sentinel

[go-nuts] Retrieving Pageview data using SearchConsole API

2021-08-02 Thread Cedric Franz
Hi, I am trying to retrieve the number of page clicks recorded in GA per page on out site for a date range using the searchconsole/v1 library. I have created an API key for out project and it has not API restricts set yet. I have the following questions: 1) is this the best API to use to retri

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

[go-nuts] icmpengine - a small golang ping library

2021-08-02 Thread dave seddon
G'day, I hope this is an appropriate place to post about a new little library. Recently I was looking for a basic ping library but didn't have much luck, so I hope the community will find this helpful: https://github.com/EdgeCast/icmpengine Feedback welcome. Kind regards, Dave Seddon -- You

[go-nuts] Go 1.17 Release Candidate 2 is released

2021-08-02 Thread Alex Rakoczy
Hello gophers, We have just released go1.17rc2, a release candidate version of Go 1.17. It is cut from release-branch.go1.17 at the revision tagged go1.17rc2. Please try your production load tests and unit tests with the new version. Your help testing these pre-release versions is invaluable. Re