-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
Milestone
Description
gotype
fails to import local (not relative) packages within a Docker container.
Context
go
is installed in a Docker container, the base image is alpine:3.2
.
See the Dockerfile.
Steps
1. Mount the current path on the host dynamically in the container to fit in the GOPATH within the container: let's say my PWD is ~/go/foo/bla
on my host, then I run the following command:
$ docker run --rm \
-v $PWD:/root/go/src/github.com/foo/bla \
-w /root/go/src/github.com/foo/bla \
-it mycompany/go bash
2. Run gotype .
in the project folder (located in the GOPATH)
Then I get the following errors:
cli.go:8:2: could not import github.com/foo/bla/logger (can't find import: github.com/foo/bla/logger)
cli.go:9:2: could not import github.com/foo/bla/processor (can't find import: github.com/foo/bla/processor)
cli.go:125:2: undeclared name: logger
cli.go:130:4: undeclared name: logger
cli.go:133:3: undeclared name: logger
cli.go:136:7: undeclared name: processor
The project local dependencies can't be imported. The other imports are OK though.
Environment
$ go version
go version go1.5.1 linux/amd64
$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT=""
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"