Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.13 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
$ go env GO111MODULE="on" GOARCH="amd64" GOBIN="/home/rvolosatovs/.local/bin.go" GOCACHE="/home/rvolosatovs/.local/cache/go-build" GOENV="/home/rvolosatovs/.config/go/env" GOEXE="" GOFLAGS="-tags=tti" GOHOSTARCH="amd64" GOHOSTOS="linux" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/rvolosatovs:/nix/store/b02sg3w3h50k3h8f53mix6ivd9zh8fm2-go-1.13/share/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/nix/store/b02sg3w3h50k3h8f53mix6ivd9zh8fm2-go-1.13/share/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/nix/store/b02sg3w3h50k3h8f53mix6ivd9zh8fm2-go-1.13/share/go/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="0" GOMOD="/home/rvolosatovs/src/go.thethings.network/lorawan-stack/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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build061535754=/tmp/go-build -gno-record-gcc-switches"
What did you do?
go get -u -v
Fails on go 1.13
The project contains both go.mod
(https://github.com/rvolosatovs/lorawan-stack/blob/ce9328f83312201d231b4183413c969260b5a5a1/go.mod) and go.sum
(https://github.com/rvolosatovs/lorawan-stack/blob/ce9328f83312201d231b4183413c969260b5a5a1/go.sum)
go mod tidy
, go mod download
and go mod vendor
work fine
What did you expect to see?
Dependency update
What did you see instead?
go get .: cannot find package
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
thepudds commentedon Sep 4, 2019
@rvolosatovs What happens if you try
go get -u -v ./...
?If you do
go get -u ./...
from your module root, it upgrades the direct and indirect dependencies of your module, exclusive of test dependencies.From the Go 1.13 release notes:
The last sentence might be describing what you see.
Do you have any
*.go
files in your working directory when you dogo get -u -v
without any arguments? If not, then thego
command might be complaining that you've asked to upgrade dependencies of the current package, but the current package does not exist (given a Go package is made up of*.go
source files in a particular directory).[-]cmd/go: go get fails with "cannot find package"[/-][+]cmd/go: 'go get -u' in 1.13 fails with 'go get .: cannot find package'[/+]rvolosatovs commentedon Sep 4, 2019
Adding a
go
file in the root directory with no build constraints fixed the issue. (TheThingsNetwork/lorawan-stack@29b8003)Thanks, @thepudds
I suppose what I encountered is exactly what
entails
thepudds commentedon Sep 5, 2019
@rvolosatovs @bcmills what would you think about re-opening this as a tracking issue for a friendlier message here?
(The current message says
go get .
, but the user never typed.
. The current message sayscannot find package
, but doesn't directly say what package it cannot find, etc.)rvolosatovs commentedon Sep 5, 2019
The error message is indeed very confusing for a user, who does not expect it.
Now that I know what caused the issue, it's clear what it means, but it was absolutely useless for me when I encountered it.
Note, that the error is valid in fact - the package
go
cannot find is.
, i.e. the package in the current directory.So I agree that the error message is far from being user-friendly in this exact (corner) case, but on the other hand
go get -u
impliesgo get -u .
and in case of any other usage thango get -u
the invocation would actually look likego get -u <pkg>
and hence the error message would look likego get <pkg>: cannot find package
, which is perfectly fine IMO.[-]cmd/go: 'go get -u' in 1.13 fails with 'go get .: cannot find package'[/-][+]cmd/go: Confusing error message on 'go get -u' failure in 1.13[/+][-]cmd/go: Confusing error message on 'go get -u' failure in 1.13[/-][+]cmd/go: 'go get' confusing error: cannot find package[/+][-]cmd/go: 'go get' confusing error: cannot find package[/-][+]cmd/go: make the error from 'go get -u` more helpful when the current directory does not contain a package[/+][-]cmd/go: make the error from 'go get -u` more helpful when the current directory does not contain a package[/-][+]cmd/go: make the error from 'go get -u' more helpful when the current directory does not contain a package[/+]seankhliao commentedon Dec 3, 2024
go now prints: