In module-aware mode, go get with the -u flag now updates a smaller set of modules that is more consistent with the set of packages updated by go get -u in GOPATH mode. go get -u continues to update the modules and packages named on the command line, but additionally updates only the modules containing the packages imported by the named packages, rather than the transitive module requirements of the modules containing the named packages.
Note in particular that go get -u (without additional arguments) now updates only the transitive imports of the package in the current directory
The last sentence might be describing what you see.
Do you have any *.go files in your working directory when you do go get -u -v without any arguments? If not, then the go 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).
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 implies go get -u . and in case of any other usage than go get -u the invocation would actually look like go get -u <pkg> and hence the error message would look like go get <pkg>: cannot find package, which is perfectly fine IMO.
changed the title
cmd/go: 'go get -u' in 1.13 fails with 'go get .: cannot find package'Sep 5, 2019