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: panic on build with vendored depenencies #16566

Closed
0x434d53 opened this issue Aug 1, 2016 · 9 comments
Closed

cmd/go: panic on build with vendored depenencies #16566

0x434d53 opened this issue Aug 1, 2016 · 9 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@0x434d53
Copy link

0x434d53 commented Aug 1, 2016

Please answer these questions before submitting your issue. Thanks!

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

go version go1.7rc3 darwin/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/seufert/Dev/GOCODE"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.7rc3/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.7rc3/libexec/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/m5/04gz8l2941vgv9_8ggx_s8_80000gn/T/go-build763588522=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"

3. What did you do?

Build my program (a main package, only one file in the directory) from Vim using vim-go.

I wasn't able to reproduce the problem in a simpler sample that i can easily share.

4. What did you expect to see?

That it will build, because if i do it from the shell directly by "go build" it will build successfully.

5. What did you see instead?

panic: runtime error: slice bounds out of range

goroutine 1 [running]:
panic(0x3df380, 0xc420014110)
/usr/local/Cellar/go/1.7rc3/libexec/src/runtime/panic.go:500 +0x1a1
main.vendoredImportPath(0xc4201b2900, 0xc4201a71a1, 0x28, 0x3, 0x0)
/usr/local/Cellar/go/1.7rc3/libexec/src/cmd/go/pkg.go:463 +0x668
main.loadImport(0xc4201a71a1, 0x28, 0xc420179490, 0x66, 0xc4201b2900, 0xc4201ed9e0, 0xc4200b3ea0, 0x4, 0x4, 0x1, ...)
/usr/local/Cellar/go/1.7rc3/libexec/src/cmd/go/pkg.go:333 +0x9ea
main.(_Package).load(0xc4201b2900, 0xc4201ed9e0, 0xc4201b4700, 0x0, 0x0, 0x4)
/usr/local/Cellar/go/1.7rc3/libexec/src/cmd/go/pkg.go:940 +0x12aa
main.loadImport(0xc420188f91, 0x23, 0xc42001b500, 0x50, 0xc420194000, 0xc4201ed9e0, 0xc420189410, 0x1, 0x1, 0x1, ...)
/usr/local/Cellar/go/1.7rc3/libexec/src/cmd/go/pkg.go:374 +0x470
main.(_Package).load(0xc420194000, 0xc4201ed9e0, 0xc420173500, 0x0, 0x0, 0xc)
/usr/local/Cellar/go/1.7rc3/libexec/src/cmd/go/pkg.go:940 +0x12aa
main.loadImport(0x4466a5, 0x1, 0xc42001a004, 0x50, 0x0, 0xc4201ed9e0, 0x0, 0x0, 0x0, 0x0, ...)
/usr/local/Cellar/go/1.7rc3/libexec/src/cmd/go/pkg.go:374 +0x470
main.loadPackage(0x4466a5, 0x1, 0xc4201ed9e0, 0x0)
/usr/local/Cellar/go/1.7rc3/libexec/src/cmd/go/pkg.go:1658 +0x28f
main.packagesAndErrors(0xc420184cc0, 0x2, 0x2, 0xc42015fec0, 0x20, 0x3f16a0)
/usr/local/Cellar/go/1.7rc3/libexec/src/cmd/go/pkg.go:1703 +0x327
main.packagesForBuild(0xc42000c320, 0x2, 0x2, 0x4910b0, 0xc42000c180, 0x0)
/usr/local/Cellar/go/1.7rc3/libexec/src/cmd/go/pkg.go:1719 +0x75
main.runBuild(0x627520, 0xc42000c320, 0x2, 0x2)
/usr/local/Cellar/go/1.7rc3/libexec/src/cmd/go/build.go:440 +0xcc
main.main()
/usr/local/Cellar/go/1.7rc3/libexec/src/cmd/go/main.go:181 +0x624

If it's an error regarding vim-go or not, that it does not build: It cannot be correct, that the compiler just panics without any useful hint what went wrong.

@0x434d53
Copy link
Author

0x434d53 commented Aug 1, 2016

Tested it also with go 1.6.3 on the same platform:

Same error:

panic: runtime error: slice bounds out of range

goroutine 1 [running]:
panic(0x53b3c0, 0xc8200120a0)
/usr/local/Cellar/go/1.6.3/libexec/src/runtime/panic.go:481 +0x3e6
main.vendoredImportPath(0xc820249000, 0xc820229141, 0x28, 0x0, 0x0)
/usr/local/Cellar/go/1.6.3/libexec/src/cmd/go/pkg.go:466 +0x713
main.loadImport(0xc820229141, 0x28, 0xc82018b810, 0x66, 0xc820249000, 0xc820459750, 0xc82009fcc0, 0x4, 0x4, 0x1, ...)
/usr/local/Cellar/go/1.6.3/libexec/src/cmd/go/pkg.go:336 +0xe52
main.(_Package).load(0xc820249000, 0xc820459750, 0xc8202fea80, 0x0, 0x0, 0x4)
/usr/local/Cellar/go/1.6.3/libexec/src/cmd/go/pkg.go:953 +0x4397
main.loadImport(0xc8201b0631, 0x23, 0xc820156f60, 0x50, 0xc82018cc00, 0xc820459750, 0xc8201b0ab0, 0x1, 0x1, 0x1, ...)
/usr/local/Cellar/go/1.6.3/libexec/src/cmd/go/pkg.go:377 +0x84e
main.(_Package).load(0xc82018cc00, 0xc820459750, 0xc820189500, 0x0, 0x0, 0xc)
/usr/local/Cellar/go/1.6.3/libexec/src/cmd/go/pkg.go:953 +0x4397
main.loadImport(0x5defd0, 0x1, 0xc820018004, 0x50, 0x0, 0xc820459750, 0x0, 0x0, 0x0, 0x0, ...)
/usr/local/Cellar/go/1.6.3/libexec/src/cmd/go/pkg.go:377 +0x84e
main.loadPackage(0x5defd0, 0x1, 0xc820459750, 0x0)
/usr/local/Cellar/go/1.6.3/libexec/src/cmd/go/pkg.go:1639 +0x13d8
main.packagesAndErrors(0xc82014d4e0, 0x2, 0x2, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.6.3/libexec/src/cmd/go/pkg.go:1684 +0x531
main.packagesForBuild(0xc82000a320, 0x2, 0x2, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.6.3/libexec/src/cmd/go/pkg.go:1700 +0x82
main.runBuild(0x888ae0, 0xc82000a320, 0x2, 0x2)
/usr/local/Cellar/go/1.6.3/libexec/src/cmd/go/build.go:442 +0x8d
main.main()
/usr/local/Cellar/go/1.6.3/libexec/src/cmd/go/main.go:181 +0x783

@quentinmit quentinmit added this to the Go1.8 milestone Aug 1, 2016
@quentinmit
Copy link
Contributor

Since this isn't a regression in 1.7, I'm afraid it will have to wait for 1.8 at this point.

@0x434d53
Copy link
Author

0x434d53 commented Aug 1, 2016

Any hints how i could try to collect more information to help narrowing down the problem?

@minux
Copy link
Member

minux commented Aug 2, 2016 via email

@josharian
Copy link
Contributor

Possibly related: #14826

@0x434d53
Copy link
Author

0x434d53 commented Aug 2, 2016

@minux Did that: It works if the gopath is entirely empty and i just use the vendored dependencies. I will try to build it up from there until i can trigger the problem (will take some time, my working GOPATH ofc isn't small).

@josharian josharian changed the title Go: Panic on Build with vendored depenencies cmd/go: panic on build with vendored depenencies Aug 3, 2016
@mrd0ll4r
Copy link

mrd0ll4r commented Aug 31, 2016

I encountered this today, maybe I can throw in some helpful information.

  1. go version:

    go version go1.7 linux/amd64

  2. go env:

    GOBIN=""
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH="/home/ubuntu/go"
    GORACE=""
    GOROOT="/usr/local/go"
    GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
    CC="gcc"
    GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build254745306=/tmp/go-build -gno-record-gcc-switches"
    CXX="g++"
    CGO_ENABLED="1"
    
  3. What did you do?

    Installed Go yesterday, did a

    go get github.com/reconquest/orgalorg
    

    and all went well. I had an issue with orgalorg that I filed with them. They fixed it overnight, so today I wanted to update to the newest version and executed

    go get -u github.com/reconquest/orgalorg
    
  4. What did you expect to see?

    No panic

  5. What did you see instead?

    panic: runtime error: slice bounds out of range
    
    goroutine 1 [running]:
    panic(0x7e18e0, 0xc420010100)
    /usr/local/go/src/runtime/panic.go:500 +0x1a1
    main.vendoredImportPath(0xc42056ad80, 0xc42043b2e1, 0x16, 0x3, 0x0)
    /usr/local/go/src/cmd/go/pkg.go:463 +0x66c
    main.loadImport(0xc42043b2e1, 0x16, 0xc4202a4ba0, 0x53, 0xc42056ad80, 0xc4205659f8, 0xc4203a97a0, 0x1, 0x1, 0x1, ...)
    /usr/local/go/src/cmd/go/pkg.go:333 +0x9ea
    main.(*Package).load(0xc42056ad80, 0xc4205659f8, 0xc42023b180, 0x0, 0x0, 0x4)
    /usr/local/go/src/cmd/go/pkg.go:940 +0x12b6
    main.loadImport(0xc42044f901, 0x19, 0xc4201c6e00, 0x32, 0xc420653680, 0xc4205659f8, 0xc4203b3b80, 0x4, 0x4, 0x1, ...)
    /usr/local/go/src/cmd/go/pkg.go:374 +0x470
    main.(*Package).load(0xc420653680, 0xc4205659f8, 0xc420614380, 0x0, 0x0, 0xc)
    /usr/local/go/src/cmd/go/pkg.go:940 +0x12b6
    main.loadImport(0x7ffc3cacf7df, 0x1e, 0xc420012084, 0x16, 0x0, 0xc4205659f8, 0x0, 0x0, 0x0, 0x0, ...)
    /usr/local/go/src/cmd/go/pkg.go:374 +0x470
    main.loadPackage(0x7ffc3cacf7df, 0x1e, 0xc4205659f8, 0x0)
    /usr/local/go/src/cmd/go/pkg.go:1658 +0x28f
    main.packagesAndErrors(0xc420255c50, 0x1, 0x1, 0xc420255b60, 0x1e, 0x848c6d)
    /usr/local/go/src/cmd/go/pkg.go:1703 +0x337
    main.packagesForBuild(0xc420255b60, 0x1, 0x1, 0xc420255b60, 0x1, 0x1)
    /usr/local/go/src/cmd/go/pkg.go:1719 +0x75
    main.runGet(0xa27940, 0xc420255b60, 0x1, 0x1)
    /usr/local/go/src/cmd/go/get.go:130 +0x320
    main.main()
    /usr/local/go/src/cmd/go/main.go:181 +0x624
    

Additional info:

  • I started yesterday with an empty GOPATH
  • Commit before updating (state yesterday): 593781a7e85cb5d45374a239d21349e37e731e0d
  • Commit after go get -updating: 635f31a1cf33c6b3253d3906379355a58ce67def
  • The commits in between introduced some new vendored dependencies AFAIK, apart from fixing my unrelated issue
  • It only occurred on the first upgrade from the old version to the new version. Subsequent builds don't fail.

@quentinmit
Copy link
Contributor

Possible dupe of #16167 which has a better repro?

@quentinmit quentinmit added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 6, 2016
@gopherbot
Copy link

CL https://golang.org/cl/31665 mentions this issue.

@golang golang locked and limited conversation to collaborators Oct 24, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge 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

6 participants