Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: errors.As warning for no apparent reason #41903

Closed
pofl opened this issue Oct 10, 2020 · 3 comments
Closed

x/tools/gopls: errors.As warning for no apparent reason #41903

pofl opened this issue Oct 10, 2020 · 3 comments

Comments

@pofl
Copy link

@pofl pofl commented Oct 10, 2020

What version of Go are you using (go version)?

$ go version
go version go1.15.2 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/pofl/.cache/go-build"
GOENV="/home/pofl/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/pofl/Documents/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/pofl/Documents/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/linuxbrew/.linuxbrew/Cellar/go/1.15.2/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/linuxbrew/.linuxbrew/Cellar/go/1.15.2/libexec/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc-5"
CXX="g++-5"
CGO_ENABLED="1"
GOMOD="/home/pofl/dwh-kafka2pubsub/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build040311524=/tmp/go-build -gno-record-gcc-switches"

What did you do?

image

What did you expect to see?

no complaints

What did you see instead?

warning "second argument to errors.As must be a non-nil pointer to either a type that implements error, or to any interface type"

@gopherbot gopherbot added this to the Unreleased milestone Oct 10, 2020
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Oct 10, 2020

I believe what you want here is errors.As(err, &e), since *connErr implements error, and the second argument must be a pointer to a type that implements error.

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Oct 10, 2020

Mistyped in the earlier response--I meant errors.As(err, &e).

@pofl
Copy link
Author

@pofl pofl commented Oct 11, 2020

You're right. Damn, go is so quirky sometimes. Thank you for answering.

@pofl pofl closed this Oct 11, 2020
@pofl pofl reopened this Oct 11, 2020
@pofl pofl closed this Oct 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.