go get deprecation message

258 views
Skip to first unread message

fge...@gmail.com

unread,
May 24, 2022, 3:47:09 AM5/24/22
to golang-dev
Hi,

I've tried to check relevant parts from #40276 and some other
referenced issues, but I could not find a reason why the deprecation
message would not be more helpful with a rewritten instruction using
the package reference from the original command.

Current (go1.18) behaviour:
; go get 9fans.net/go/acme/acmego
go: go.mod file not found in current directory or any parent directory.
'go get' is no longer supported outside a module.
To build and install a command, use 'go install' with a version,
like 'go install example.com/cmd@latest'
For more information, see
https://golang.org/doc/go-get-install-deprecation
or run 'go help get' or 'go help install'.

A more helpful version:
; go get 9fans.net/go/acme/acmego
...
To build and install a command, use 'go install' with a version,
like 'go install 9fans.net/go/acme/acmego@latest'
...

Could somebody please point me to any relevant discussion?
Thanks!

Bryan C. Mills

unread,
May 24, 2022, 12:20:50 PM5/24/22
to fge...@gmail.com, golang-dev
I believe that the current suggestion message was added in https://go.dev/cl/305670.

I think the reason it doesn't print the specific command-line arguments is for implementation simplicity: otherwise, we would have to go through each of the package patterns and identify which ones include `main` packages.

--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-dev/CA%2BctqroiJfo7%3DM40eDOiko4b0VjHEc8LYUZRDf7VrgxERvxcxw%40mail.gmail.com.

fge...@gmail.com

unread,
May 24, 2022, 3:01:11 PM5/24/22
to Bryan C. Mills, golang-dev
Thanks!
Could you please point me to a definition-description of the package pattern?

Bryan C. Mills

unread,
May 24, 2022, 3:07:20 PM5/24/22
to fge...@gmail.com, golang-dev
Documentation is here:
Implementation is here:

(And the call site can be found in the previously-linked CL. That part hasn't changed terribly much since then.)

fge...@gmail.com

unread,
May 24, 2022, 3:38:52 PM5/24/22
to Bryan C. Mills, golang-dev
Thanks!
If I understand the documentation and search.go and
https://go.dev/cl/305670 correctly, go get should check if the package
pattern refers to an executable. Do I understand correctly?
Maybe I am missing something, but at the moment outside the scope of a
go.mod file go get does not do that.
What is the intended behaviour?
For how many more releases is the deprecation message is planned to be shown?
What's the planned response after that?
thanks!

Bryan C. Mills

unread,
May 24, 2022, 3:56:44 PM5/24/22
to fge...@gmail.com, golang-dev
On Tue, May 24, 2022 at 3:38 PM <fge...@gmail.com> wrote:
Thanks!
If I understand the documentation and search.go and
https://go.dev/cl/305670 correctly, go get should check if the package
pattern refers to an executable. Do I understand correctly?

Yep!

Maybe I am missing something, but at the moment outside the scope of a
go.mod file go get does not do that.
What is the intended behaviour?

As of Go 1.18, `go get` in module mode only updates the dependencies of your module.
(And “in module mode” is the default since Go 1.16, even when your working directory is not in a module.)
If your working directory is not in a module, then `go get` has no place to record those dependencies, so it can't do the one thing that it still does.
 
For how many more releases is the deprecation message is planned to be shown?

At the moment we plan to remove it in Go 1.20.
 
What's the planned response after that?

In module mode within a module, `go get` will not log anything to the console — it will just update your dependencies.

In module mode outside of a module, `go get` will error out with “go.mod file not found in current directory or any parent directory” without suggesting an alternative.
Reply all
Reply to author
Forward
0 new messages