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

go install package pattern doesn't work like go get in 1.17 #49101

Closed
ronaldpetty opened this issue Oct 21, 2021 · 7 comments
Closed

go install package pattern doesn't work like go get in 1.17 #49101

ronaldpetty opened this issue Oct 21, 2021 · 7 comments

Comments

@ronaldpetty
Copy link

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

$ go version
go version go1.17.2 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=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ubuntu/.cache/go-build"
GOENV="/home/ubuntu/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/ubuntu/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ubuntu/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"
GOVCS=""
GOVERSION="go1.17.2"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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-build3045291618=/tmp/go-build -gno-record-gcc-switches"

What did you do?

ubuntu@ip-172-31-46-214:~$ go get -u golang.org/x/tools/...
go: downloading golang.org/x/tools v0.1.7
go: downloading golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: downloading golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d
go: downloading golang.org/x/sys v0.0.0-20211020174200-9d6173849985
go: downloading golang.org/x/net v0.0.0-20211020060615-d418f374d309
go: downloading github.com/yuin/goldmark v1.4.0
go: downloading github.com/yuin/goldmark v1.4.2
go: downloading golang.org/x/mod v0.4.2
go: downloading golang.org/x/mod v0.5.1
go: downloading golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
go: downloading golang.org/x/text v0.3.6
go: downloading golang.org/x/text v0.3.7
go get: installing executables with 'go get' in module mode is deprecated.
	Use 'go install pkg@version' instead.
	For more information, see https://golang.org/doc/go-get-install-deprecation
	or run 'go help get' or 'go help install'.

ubuntu@ip-172-31-46-214:~$ go clean -modcache

ubuntu@ip-172-31-46-214:~$ go install golang.org/x/tools/...
go: warning: "golang.org/x/tools/..." matched no packages
ubuntu@ip-172-31-46-214:~$ 

What did you expect to see?

Per the help page, install supports package pattern wildcard ..., so assumed it would work the same.

What did you see instead?

No packages.

@seankhliao
Copy link
Member

the @version part is important

For questions please refer to https://github.com/golang/go/wiki/Questions

@ronaldpetty
Copy link
Author

ronaldpetty commented Oct 21, 2021

@seankhliao I got it working, but I don't understand, as the docs don't say what to do (not sure why you listed what you did).

  • The output says go to https://golang.org/doc/go-get-install-deprecation, which doesn't mention patterns
  • The get output says use install (implies almost to do exact thing get -> install), doesn't work with versions
  • What did work is below, and nowhere in any of those docs mentioned it (unless I am blind); maybe the 'go get' should have a patten matching example (because you can't go install or get the tools now). Also tools page also has incorrect usage on it (https://pkg.go.dev/golang.org/x/tools#section-readme).

Of course after submitting a bug, I got 'something' to work 30s later.

ubuntu@ip-172-31-46-214:~$ go install golang.org/x/tools/...@latest
go: downloading golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: downloading golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d
go: downloading github.com/yuin/goldmark v1.4.0
go: downloading golang.org/x/mod v0.4.2
go: downloading golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
go: downloading golang.org/x/text v0.3.6

ubuntu@ip-172-31-46-214:~$ ls ~/go/bin

authtest  callgraph     cover    example.com     findcall    gitauth          godoc      gopackages  gotype  helper        lostcancel  outyet      server      ssadump   stringintconv
benchcmp  compilebench  digraph  fieldalignment  fiximports  go-contrib-init  goimports  gorename    goyacc  html2article  netrcauth   present     shadow      stress    toolstash
bundle    cookieauth    eg       file2fuzz       getgo       godex            gomvpkg    gostacks    guru    ifaceassert   nilness     present2md  splitdwarf  stringer  unmarshal
ubuntu@ip-172-31-46-214:~$

I would go as far saying this is a documentation bug at a minimum; I checked three places (per the tools themselves) and none of them work or explain what to do next.

@seankhliao
Copy link
Member

The 'something' is correct. The go get output says to use go install pkg@version and the linked documentation explains the differences between with or without @version. The pattern is irrelevant.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/357714 mentions this issue: all: update install commands to go install pkg@version

@ronaldpetty
Copy link
Author

I guess I don't understand how the pattern is irrelevant. The point of the patter was to download all the packages. Without the pattern you have to know the name of the packages and do each one.

@seankhliao
Copy link
Member

The pattern is irrelevant for the deprecation, which turns an binary install command from go get example.com/... into go install example.com/...@latest. The changes are get -> install and adding a @version suffix

@ronaldpetty
Copy link
Author

Looking back and based on what you just wrote I agree that is the change. Thanks for helping.

I do feel what you wrote is more clear than all of the other docs, including the propsal

https://golang.org/doc/go-get-install-deprecation

where they mention patterns only briefly:

Command line arguments must refer to main packages (executables). If a
argument has a wildcard (...), it will only match main packages.

Command line arguments must refer to packages in one module at a specific
version. All version suffixes must be identical. The versions of the
installed packages' dependencies are determined by that module's go.mod
file (if it has one).

All those words (in proposal and other help sources, could be improved with your comment.

Thanks again.

gopherbot pushed a commit to golang/tools that referenced this issue Oct 27, 2021
Updates golang/go#43684
Updates golang/go#49101

Change-Id: I2f0c7920bcd6ce0429f1b7bdda3747bf376775f2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/357714
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Trust: Rebecca Stambler <rstambler@golang.org>
Trust: Peter Weinberger <pjw@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
@golang golang locked and limited conversation to collaborators Oct 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants