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: go mod vendor in empty new project produces confusing error message in 1.14 #37464

Closed
cocorambo opened this issue Feb 26, 2020 · 3 comments
Labels
FrozenDueToAge GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@cocorambo
Copy link

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

go version go1.14 linux/amd64

Does this issue reproduce with the latest release?

yes

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

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/nmartin/.cache/go-build"
GOENV="/home/nmartin/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/nmartin/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build614761053=/tmp/go-build -gno-record-gcc-switches"

What did you do?

mkdir -p /tmp/go-vendor
cd /tmp/go-vendor
go mod init github.com/cocorambo/govendor
go get github.com/sirupsen/logrus
go mod vendor

What did you expect to see?

I expect go command to create vendor directory and modules.txt file

What did you see instead?

go mod vendor: open /tmp/go-vendor/vendor/modules.txt: no such file or directory
@cocorambo cocorambo changed the title Start a new project with vendoring Go 1.14: start a new project with vendoring Feb 26, 2020
@cocorambo cocorambo changed the title Go 1.14: start a new project with vendoring Go 1.14: start a new project with vendor fail Feb 26, 2020
@cocorambo
Copy link
Author

cocorambo commented Feb 26, 2020

It finally works, I was missing to at least import module in a Go file

For example create a main.go with this content and it works

package main

import (
	_ "github.com/sirupsen/logrus"
)

So this is clearly not a bug but error message could be more appropriate I think

By running go mod vendor with no require in go.mod file, we get this message which is clearer:

go: no dependencies to vendor

@oiooj oiooj added the modules label Feb 26, 2020
@dmitshur dmitshur changed the title Go 1.14: start a new project with vendor fail cmd/go: go mod vendor in empty new project produces confusing error message in 1.14 Feb 26, 2020
@dmitshur
Copy link
Contributor

/cc @bcmills @matloob @jayconrod

@dmitshur dmitshur added GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Feb 26, 2020
@dmitshur dmitshur added this to the Backlog milestone Feb 26, 2020
@bcmills
Copy link
Contributor

bcmills commented Feb 26, 2020

Duplicate of #36580

@bcmills bcmills marked this as a duplicate of #36580 Feb 26, 2020
@bcmills bcmills closed this as completed Feb 26, 2020
@golang golang locked and limited conversation to collaborators Feb 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go modules 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

5 participants