You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While recently troubleshooting an issue, I found that it was very useful to include the specific error message in the error returned by the function unmarshal(data []byte, v interface{}) error in restapi.go.
Currently, we swallow the specific error message:
funcunmarshal(data []byte, vinterface{}) error {
err:=json.Unmarshal(data, v)
iferr!=nil {
// err is effectively lost herereturnErrJSONUnmarshal
}
returnnil
}
Instead, we can wrap ErrJSONUnmarshal and include the specific error message:
This error wrapping functionality was introduced to the standard library in Go 1.13, so I believe we should update the go.mod file as well. Background: https://blog.golang.org/go1.13-errors
Fortunately, the CI process only tests 1.13 and later so in a sense we already no longer support Go versions less than 1.13. While we're working on this, and since Go 1.16 has been out for awhile, might as well update the CI to test with 1.16 too:
language: gogo:
- 1.13.x
- 1.14.x
- 1.15.x
- 1.16.xenv:
- GO111MODULE=oninstall:
- go get github.com/bwmarrin/discordgo
- go get -v .
- go get -v golang.org/x/lint/golintscript:
- diff <(gofmt -d .) <(echo -n)
- go vet -x ./...
- golint -set_exit_status ./...
- go test -v -race ./...
The text was updated successfully, but these errors were encountered:
While recently troubleshooting an issue, I found that it was very useful to include the specific error message in the error returned by the function
unmarshal(data []byte, v interface{}) error
inrestapi.go
.Currently, we swallow the specific error message:
Instead, we can wrap
ErrJSONUnmarshal
and include the specific error message:This error wrapping functionality was introduced to the standard library in Go 1.13, so I believe we should update the
go.mod
file as well. Background: https://blog.golang.org/go1.13-errorsFortunately, the CI process only tests 1.13 and later so in a sense we already no longer support Go versions less than 1.13. While we're working on this, and since Go 1.16 has been out for awhile, might as well update the CI to test with 1.16 too:
The text was updated successfully, but these errors were encountered: