Skip to content

Commit

Permalink
cmd/getgo: create a module in preparation for deprecation
Browse files Browse the repository at this point in the history
And add deprecation notice.
Updates golang/go#60951

Change-Id: I9d4ffffc03201b038db5cc11563ea1cc5330e668
Reviewed-on: https://go-review.googlesource.com/c/tools/+/563398
Reviewed-by: Alan Donovan <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
  • Loading branch information
hyangah committed Feb 16, 2024
1 parent 451218f commit c61f99f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cmd/getgo/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
**Deprecated** - See https://go.dev/issues/60951

# getgo

A proof-of-concept command-line installer for Go.
Expand Down
4 changes: 4 additions & 0 deletions cmd/getgo/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Deprecated: follow the installation instructions at go.dev/doc/install.
module golang.org/x/tools/cmd/getgo

go 1.18
22 changes: 21 additions & 1 deletion cmd/getgo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,25 @@
//go:build !plan9
// +build !plan9

// The getgo command installs Go to the user's system.
/*
The getgo command is deprecated.
Deprecated: See https://go.dev/issues/60951.
Follow the instructions at https://go.dev/doc/install to install Go instead.
Tips:
To find the latest available go version, run:
go list -m -f '{{.Version}}' go@latest
If you want to use the latest go by default, you can use "go env -w" to override "GOTOOLCHAIN":
go env -w GOTOOLCHAIN=go$(go list -m -f '{{.Version}}' go@latest)+auto
See https://go.dev/blog/toolchain for more information about toolchain management.
*/
package main

import (
Expand All @@ -32,6 +50,8 @@ var errExitCleanly error = errors.New("exit cleanly sentinel value")

func main() {
flag.Parse()
fmt.Fprintln(os.Stderr, "getgo is deprecated. See https://pkg.go.dev/golang.org/x/tools/cmd/getgo.")

if *goVersion != "" && !strings.HasPrefix(*goVersion, "go") {
*goVersion = "go" + *goVersion
}
Expand Down

0 comments on commit c61f99f

Please sign in to comment.