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

cmd/go: expected 'package', found 'EOF' errors with module indexing enabled on WSL2 #54651

Open
jhaumont opened this issue Aug 24, 2022 · 10 comments
Labels
GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@jhaumont
Copy link

jhaumont commented Aug 24, 2022

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

$ go version
go version go1.19 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/jhaumont/.cache/go-build"
GOENV="/home/jhaumont/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/jhaumont/go/pkg/mod"
GONOPROXY="github.com/blablacar"
GONOSUMDB="github.com/blablacar"
GOOS="linux"
GOPATH="/home/jhaumont/go"
GOPRIVATE="github.com/blablacar"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/jhaumont/bin/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/jhaumont/bin/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
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 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1850192189=/tmp/go-build -gno-record-gcc-switches"

What did you do?

When installing 1.19 go version & reinstall/update the additional go tools like gopls & dlv, I have an issue with delve and the package https://github.com/hashicorp/golang-lru/tree/master/simplelru.
So, I can't install delve. But if I use the 1.18.5 version of go, I have no issue and I can install the last delve version (1.9.0)

But if I use GODEBUG=goindex=0, it works :)

Reproduce:
I try to do a fresh install of go (with 1.19.0) and then, install delve.

  • Install go:
rm -rf ${HOME}/bin/go
cd "$(mktemp -d)"
wget https://go.dev/dl/go1.19.linux-amd64.tar.gz
tar -C ${HOME}/bin -xzf go1.19.linux-amd64.tar.gz
  • Install devel:
go install -v github.com/go-delve/delve/cmd/dlv@latest

What did you expect to see?

No error, devel is correctly installed

What did you see instead?

pkg/mod/github.com/hashicorp/golang-lru@v0.5.4/simplelru/lru.go:1:1: expected 'package', found 'EOF'

@jhaumont
Copy link
Author

jhaumont commented Aug 24, 2022

@jhaumont jhaumont changed the title affected/package: cmd/go - modindex - Can't install delve with go 1.19 cmd/go - modindex - Can't install delve with go 1.19 Aug 24, 2022
@jhaumont jhaumont changed the title cmd/go - modindex - Can't install delve with go 1.19 cmd/go - modindex: Can't install delve with go 1.19 Aug 24, 2022
@bcmills bcmills added this to the Go1.20 milestone Aug 24, 2022
@dr2chase
Copy link
Contributor

dr2chase commented Aug 24, 2022

Assigned @bcmills for now, anyone looking at this should know that this is not reproducible in general (I tried with 1.19 and tip on macOS and Linux), but there was nonetheless a problem, which is linked to the delve bug and referenced files above. So it remains open.

@dr2chase dr2chase added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 24, 2022
@jhaumont
Copy link
Author

jhaumont commented Aug 25, 2022

By the way @dr2chase, I work with Debian on WSL.

@bcmills bcmills changed the title cmd/go - modindex: Can't install delve with go 1.19 cmd/go: error installing delve with go 1.19 with module indexing enabled Aug 25, 2022
@jhaumont
Copy link
Author

jhaumont commented Sep 8, 2022

Hello
I face the same issue with 2 new packages (not link to delve) on an internal go projet:
../../go/pkg/mod/github.com/armon/go-radix@v1.0.0/radix.go:1:1: expected 'package', found 'EOF' ../../go/pkg/mod/github.com/mitchellh/mapstructure@v1.5.0/decode_hooks.go:1:1: expected 'package', found 'EOF'
Using GODEBUG=goindex=0 fix the issue

@bcmills
Copy link
Member

bcmills commented Sep 8, 2022

@jhaumont, just to rule out filesystem weirdness, what filesystem are you using for /home/jhaumont/go/pkg/mod?

@bcmills
Copy link
Member

bcmills commented Sep 8, 2022

And does running go clean -cache also fix the issue (without GODEBUG=goindex=0) when it happens?

@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Sep 8, 2022
@jhaumont
Copy link
Author

jhaumont commented Sep 9, 2022

@bcmills I'm on WSL. This is the result of mount | column -t command:
/dev/sdc on / type ext4 (rw,relatime,discard,errors=remount-ro,data=ordered)
And for the second question, the answer is no (I already test it before opening the issue)

@aarzilli
Copy link
Contributor

aarzilli commented Sep 9, 2022

Is this WSL1 or WSL2?

@jhaumont
Copy link
Author

jhaumont commented Sep 9, 2022

@aarzilli WSL2 with debian

@bcmills bcmills removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Sep 19, 2022
@bcmills
Copy link
Member

bcmills commented Sep 19, 2022

This is currently the only report we have of this kind of corruption. It's not clear to me whether this is a bug in Go, a bug in WSL2, or both. Moving to the Backlog pending more user reports and/or test failures that might shed some light for debugging.

@bcmills bcmills modified the milestones: Go1.20, Backlog Sep 19, 2022
@bcmills bcmills removed their assignment Sep 19, 2022
@bcmills bcmills changed the title cmd/go: error installing delve with go 1.19 with module indexing enabled cmd/go: expected 'package', found 'EOF' errors with module indexing enabled on WSL2 Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants