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/go/packages: loader doesn't handle/recognize "context canceled" error #37115

Open
mmirolim opened this issue Feb 7, 2020 · 2 comments
Open

Comments

@mmirolim
Copy link

@mmirolim mmirolim commented Feb 7, 2020

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

$ go version
go version go1.13.7 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/mm/.cache/go-build"
GOENV="/home/mm/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/mm/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/mm/go/src/github.com/mmirolim/gtr/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-build542977077=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I used packages.Load function with Config.Context set. If context canceled and packages.loader in loadPackage function, appendError prints "internal error" message
https://github.com/golang/tools/blob/master/go/packages/packages.go#L791

To reproduce error, we can inject delay in loader.loadRecursive/loadPackage function and
modify testParseFileModifyAST, set context to config, which will be canceled before delay in loader.
https://github.com/golang/tools/blob/master/go/packages/packages_test.go#L870

What did you expect to see?

no error messages in stdout

What did you see instead?

..... many lines of ...
2020/02/07 16:18:23 internal error: error "context canceled" (*errors.errorString) without position
.....

@cagedmantis
Copy link
Contributor

@cagedmantis cagedmantis commented Feb 7, 2020

/cc @matloob

@matloob
Copy link
Contributor

@matloob matloob commented Feb 7, 2020

cc @stamblerre

This sounds reasonable to me, i'll let rstambler confirm if it's okay.

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
4 participants