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

proposal: go/cmd: install should assume @latest in most cases #58285

Closed
ConradIrwin opened this issue Feb 3, 2023 · 2 comments
Closed

proposal: go/cmd: install should assume @latest in most cases #58285

ConradIrwin opened this issue Feb 3, 2023 · 2 comments

Comments

@ConradIrwin
Copy link
Contributor

As a go programmer I create command line tools that I want to download and use on various machines. I'd like it to be as easy as possible to install those tools when I need them.

Until go1.18 it was possible to run go get github.com/superhuman/url64. This feature was moved to go install, and as part of that the syntax was changed to require @latest on the end, otherwise you (usually) get one of two possible error messages:

# in a module
$ go install github.com/superhuman/url64
no required module provides package github.com/superhuman/url64; to add it:
	go get github.com/superhuman/url64

# not in a module
$ go install github.com/superhuman/url64
go: 'go install' requires a version when current directory is not in a module
	Try 'go install github.com/superhuman/url64@latest' to install the latest version

I propose that:

  • In a module that has a specific version of github.com/superhuman/url64 in its go.mod: go install github.com/superhuman/url64 would act as it does today.
  • Otherwise (outside of a module, or in a module that does not have it as a dependency): go install github.com/superhuman/url64 should be equivalent to go install github.com/superhuman/url64@latest

This gives you the same behaviour as following the instructions in the current error messages, automatically.

@gopherbot gopherbot added this to the Proposal milestone Feb 3, 2023
@seankhliao
Copy link
Member

I believe this was addressed in #40276 under "Why require a version suffix when outside a module"

The inconsistency isn't something that we want.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Feb 3, 2023
@ConradIrwin
Copy link
Contributor Author

Thanks! Sorry for missing that

@golang golang locked and limited conversation to collaborators Feb 3, 2024
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