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/vgo: report failure when $GOPATH/go.mod exists #24106

Closed
pierreprinetti opened this issue Feb 24, 2018 · 3 comments

Comments

@pierreprinetti
Copy link
Contributor

commented Feb 24, 2018

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

> docker run --rm golang:1.10 go version
go version go1.10 linux/amd64

Does this issue reproduce with the latest release?

yes

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

> docker run --rm golang:1.10 go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build243627169=/tmp/go-build -gno-record-gcc-switches"

What did you do?

docker build .

Here is the Dockerfile:

FROM golang:1.10 AS builder

# Download and install vgo
RUN go get golang.org/x/vgo

# Login to github
COPY netrc /root/.netrc

# Copy the code and compile
COPY . ./
RUN vgo vendor

What did you expect to see?

Locally, vgo vendor creates a vendor directory and imports the dependencies specified in the go.mod file.

What did you see instead?

The command '/bin/sh -c vgo vendor' returned a non-zero code: 1

Here are the reported errors:

vgo: finding github.com/lib/pq v0.0.0-20180201184707-88edab080323
vgo: downloading github.com/lib/pq v0.0.0-20180201184707-88edab080323
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go" ->
        import "cmd/go/internal/vgo" [/usr/local/go/src/cmd/go/internal/vgo]: open /usr/local/go/src/cmd/go/internal/vgo: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go" ->
        import "cmd/go/internal/modconv" [/usr/local/go/src/cmd/go/internal/modconv]: open /usr/local/go/src/cmd/go/internal/modconv: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/get" ->
        import "cmd/go/internal/search" [/usr/local/go/src/cmd/go/internal/search]: open /usr/local/go/src/cmd/go/internal/search: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/load" ->
        import "cmd/go/internal/modinfo" [/usr/local/go/src/cmd/go/internal/modinfo]: open /usr/local/go/src/cmd/go/internal/modinfo: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/modconv" ->
        import "cmd/go/internal/module" [/usr/local/go/src/cmd/go/internal/module]: open /usr/local/go/src/cmd/go/internal/module: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/modconv" ->
        import "cmd/go/internal/semver" [/usr/local/go/src/cmd/go/internal/semver]: open /usr/local/go/src/cmd/go/internal/semver: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/modfetch" ->
        import "cmd/go/internal/modfetch/codehost" [/usr/local/go/src/cmd/go/internal/modfetch/codehost]: open /usr/local/go/src/cmd/go/internal/modfetch/codehost: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/modfetch" ->
        import "cmd/go/internal/modfetch/github" [/usr/local/go/src/cmd/go/internal/modfetch/github]: open /usr/local/go/src/cmd/go/internal/modfetch/github: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/modfetch" ->
        import "cmd/go/internal/modfetch/googlesource" [/usr/local/go/src/cmd/go/internal/modfetch/googlesource]: open /usr/local/go/src/cmd/go/internal/modfetch/googlesource: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/modfetch" ->
        import "cmd/go/internal/modfile" [/usr/local/go/src/cmd/go/internal/modfile]: open /usr/local/go/src/cmd/go/internal/modfile: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/modfetch" ->
        import "cmd/go/internal/web2" [/usr/local/go/src/cmd/go/internal/web2]: open /usr/local/go/src/cmd/go/internal/web2: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/modfetch" ->
        import "cmd/go/internal/webtest" [/usr/local/go/src/cmd/go/internal/webtest]: open /usr/local/go/src/cmd/go/internal/webtest: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/vgo" ->
        import "cmd/go/internal/dirhash" [/usr/local/go/src/cmd/go/internal/dirhash]: open /usr/local/go/src/cmd/go/internal/dirhash: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/vgo" ->
        import "cmd/go/internal/imports" [/usr/local/go/src/cmd/go/internal/imports]: open /usr/local/go/src/cmd/go/internal/imports: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/vgo" ->
        import "cmd/go/internal/modfetch" [/usr/local/go/src/cmd/go/internal/modfetch]: open /usr/local/go/src/cmd/go/internal/modfetch: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/vgo" ->
        import "cmd/go/internal/mvs" [/usr/local/go/src/cmd/go/internal/mvs]: open /usr/local/go/src/cmd/go/internal/mvs: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go" ->
        import "cmd/go/internal/vgo" [/usr/local/go/src/cmd/go/internal/vgo]: open /usr/local/go/src/cmd/go/internal/vgo: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/get" ->
        import "cmd/go/internal/search" [/usr/local/go/src/cmd/go/internal/search]: open /usr/local/go/src/cmd/go/internal/search: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/load" ->
        import "cmd/go/internal/modinfo" [/usr/local/go/src/cmd/go/internal/modinfo]: open /usr/local/go/src/cmd/go/internal/modinfo: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/modconv" ->
        import "cmd/go/internal/module" [/usr/local/go/src/cmd/go/internal/module]: open /usr/local/go/src/cmd/go/internal/module: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/modconv" ->
        import "cmd/go/internal/semver" [/usr/local/go/src/cmd/go/internal/semver]: open /usr/local/go/src/cmd/go/internal/semver: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/modfetch" ->
        import "cmd/go/internal/modconv" [/usr/local/go/src/cmd/go/internal/modconv]: open /usr/local/go/src/cmd/go/internal/modconv: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/modfetch" ->
        import "cmd/go/internal/modfetch/codehost" [/usr/local/go/src/cmd/go/internal/modfetch/codehost]: open /usr/local/go/src/cmd/go/internal/modfetch/codehost: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/modfetch" ->
        import "cmd/go/internal/modfetch/github" [/usr/local/go/src/cmd/go/internal/modfetch/github]: open /usr/local/go/src/cmd/go/internal/modfetch/github: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/modfetch" ->
        import "cmd/go/internal/modfetch/googlesource" [/usr/local/go/src/cmd/go/internal/modfetch/googlesource]: open /usr/local/go/src/cmd/go/internal/modfetch/googlesource: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/modfetch" ->
        import "cmd/go/internal/modfile" [/usr/local/go/src/cmd/go/internal/modfile]: open /usr/local/go/src/cmd/go/internal/modfile: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/modfetch" ->
        import "cmd/go/internal/web2" [/usr/local/go/src/cmd/go/internal/web2]: open /usr/local/go/src/cmd/go/internal/web2: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/vgo" ->
        import "cmd/go/internal/dirhash" [/usr/local/go/src/cmd/go/internal/dirhash]: open /usr/local/go/src/cmd/go/internal/dirhash: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/vgo" ->
        import "cmd/go/internal/imports" [/usr/local/go/src/cmd/go/internal/imports]: open /usr/local/go/src/cmd/go/internal/imports: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/vgo" ->
        import "cmd/go/internal/modfetch" [/usr/local/go/src/cmd/go/internal/modfetch]: open /usr/local/go/src/cmd/go/internal/modfetch: no such file or directory
vgo: import "github.com/pierreprinetti/ldb/web/src/golang.org/x/vgo/vendor/cmd/go/internal/vgo" ->
        import "cmd/go/internal/mvs" [/usr/local/go/src/cmd/go/internal/mvs]: open /usr/local/go/src/cmd/go/internal/mvs: no such file or directory

Here is the go.mod file:

module "github.com/pierreprinetti/ldb/web"

require "github.com/lib/pq" v0.0.0-20180201184707-88edab080323

I have no idea whether this is a problem of the Docker image only, in which case I apologise for posting this issue here.

@gopherbot gopherbot added this to the vgo milestone Feb 24, 2018

@pierreprinetti pierreprinetti changed the title x/vgo: vgo vendor errors x/vgo: vgo vendor errors in Docker's official Go1.10 image Feb 24, 2018

@xmikus01

This comment has been minimized.

Copy link

commented Feb 27, 2018

I have more or less the same problem with vgo vendor and it's problem in Docker and on Windows machine too...

@rsc

This comment has been minimized.

Copy link
Contributor

commented Mar 30, 2018

It looks like you have GOPATH=. and you are copying the module into that same place. The go get has the effect of creating ./src/golang.org/x/vgo, and then the COPY creates ./go.mod, so that it looks like the GOPATH's downloaded source lives inside the module. That in turn makes it look like src/golang.org/x/vgo is part of the project you are working on, and vgo gets very confused by its own (unsupported) use of vendoring.

Even if you did rm -rf src/golang.org/x/vgo after the go get, you will probably run into other problems with GOPATH and the module root being the same place. You should move one or the other instead.

I will repurpose this bug for detecting when there's a $GOPATH/go.mod and diagnosing that better.

@rsc rsc changed the title x/vgo: vgo vendor errors in Docker's official Go1.10 image x/vgo: report failure when $GOPATH/go.mod exists Mar 30, 2018

@rsc rsc added the NeedsFix label Mar 30, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Apr 20, 2018

Change https://golang.org/cl/108379 mentions this issue: cmd/go/internal/vgo: report failure when $GOPATH/go.mod exists

@kadaan kadaan referenced this issue Dec 20, 2018
4 of 4 tasks complete

@golang golang locked and limited conversation to collaborators Apr 27, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants
You can’t perform that action at this time.