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: internal imports fail across repo boundaries #11055

Closed
kortschak opened this issue Jun 4, 2015 · 1 comment
Closed

cmd/go: internal imports fail across repo boundaries #11055

kortschak opened this issue Jun 4, 2015 · 1 comment
Milestone

Comments

@kortschak
Copy link
Contributor

In the gonum project we have a github.com/gonum/internal repository that
holds shared internal code used by other repositories in the project.
From my reading of the internal packages proposal there should be no
problem doing this; there is no indication of the notion of a repository
in the proposal, just paths.

An import of a path containing the element “internal” is disallowed if
the importing code is outside the tree rooted at the parent of the
“internal” directory.

However, we are now seeing failures on tip (starting with 8f0cc6c) with e.g. the following set
up:

floats "github.com/gonum/floats" imports asm:

import "github.com/gonum/internal/asm"

The failure does not appear to be by design however:

$ go get -t -v ./...
github.com/gonum/floats (download)
panic: runtime error: slice bounds out of range
goroutine 1 [running]:
main.disallowInternal(0xc2084432f0, 0x2f, 0xc208454800, 0xc2080ebb60, 0x2)
        /home/travis/.gimme/versions/go/src/cmd/go/pkg.go:345 +0x487
main.loadImport(0xc208441941, 0x1d, 0xc2084432f0, 0x2f, 0xc2080ebb60, 0xc208443890, 0x1, 0x1, 0x0)
        /home/travis/.gimme/versions/go/src/cmd/go/pkg.go:285 +0x863
main.(*Package).load(0xc208454000, 0xc2080ebb60, 0xc208177800, 0x0, 0x0, 0x4)
        /home/travis/.gimme/versions/go/src/cmd/go/pkg.go:620 +0x413c
main.loadImport(0xc20815db41, 0x17, 0xc208010144, 0x2d, 0xc2080ebb60, 0x0, 0x0, 0x0, 0x0)
        /home/travis/.gimme/versions/go/src/cmd/go/pkg.go:278 +0x6fb
main.loadPackage(0xc20815db41, 0x17, 0xc2080ebb60, 0x0)
        /home/travis/.gimme/versions/go/src/cmd/go/pkg.go:902 +0x1398
main.download(0xc20815db41, 0x17, 0xc2080ebb60, 0xc2080eb700)
        /home/travis/.gimme/versions/go/src/cmd/go/get.go:222 +0x168d
main.download(0xc208147908, 0x15, 0xc2080ebb60, 0xc20811d901)
        /home/travis/.gimme/versions/go/src/cmd/go/get.go:255 +0x911
main.runGet(0xb95aa0, 0xc20800a0e0, 0x1, 0x1)
        /home/travis/.gimme/versions/go/src/cmd/go/get.go:79 +0x161
main.main()
        /home/travis/.gimme/versions/go/src/cmd/go/main.go:177 +0x750
goroutine 17 [syscall, locked to thread]:
runtime.goexit()
        /home/travis/.gimme/versions/go/src/runtime/asm_amd64.s:1700 +0x1
goroutine 5 [syscall]:
os/signal.loop()
        /home/travis/.gimme/versions/go/src/os/signal/signal_unix.go:22 +0x1f
created by os/signal.init.1
        /home/travis/.gimme/versions/go/src/os/signal/signal_unix.go:28 +0x3e

Originally posted at golang-dev.

@dsymonds dsymonds added this to the Go1.5 milestone Jun 4, 2015
@jrobsonchase
Copy link

Seeing this with github.com/awslabs/aws-sdk-go/aws as well.

It's importing github.com/awslabs/aws-sdk-go/internal/apierr. disallowInternal seems to be panicing when it gets a Package that's just the error: cannot find package "github.com/aws/aws-sdk-go/internal/apierr"

@rsc rsc closed this as completed in d7a8d3e Jul 13, 2015
@golang golang locked and limited conversation to collaborators Jul 13, 2016
@rsc rsc removed their assignment Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants