Skip to content

cmd/go: unclear error when 'go mod vendor' is run with no packages to vendor #36580

@jayconrod

Description

@jayconrod

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

$ go version
go version devel +3743d21270 Wed Jan 15 17:53:43 2020 +0000 darwin/amd64

Does this issue reproduce with the latest release?

no, only tip

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/jayconrod/Library/Caches/go-build"
GOENV="/Users/jayconrod/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/jayconrod/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/go/installed"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/opt/go/installed/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/jayconrod/Code/test3/go.mod"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/rq/x0692kqj6ml8cvrhcqh5bswc008xj1/T/go-build143764245=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

In an empty directory:

go mod init example.com/m
go get -d golang.org/x/tools
go mod vendor

What did you expect to see?

This is the error message from 1.13.6. This message is also printed at tip if there are no module requirements.

go: no dependencies to vendor

What did you see instead?

go mod vendor: open /Users/jayconrod/Code/test3/vendor/modules.txt: no such file or directory

This message is printed when go mod vendor tries to write modules.txt after copying packages into the vendor directory. There are no packages to vendor, so it hasn't actually created the vendor directory, and the write fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.modules

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions