1
0
mirror of https://github.com/golang/go synced 2024-11-05 17:46:16 -07:00
go/cmd/getgo
Rebecca Stambler 207d3de1fa all: fix some staticcheck errors
Updates golang/go#35718

Change-Id: I10bfd5421cd44bb58b8bcaa6e9205040c25f51be
Reviewed-on: https://go-review.googlesource.com/c/tools/+/208257
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-01-29 04:53:41 +00:00
..
server cmd/getgo/server: update to go112 GAE runtime 2019-08-22 19:19:35 +00:00
.dockerignore cmd/getgo: initial commit 2017-07-28 18:26:31 +00:00
.gitignore cmd/getgo: initial commit 2017-07-28 18:26:31 +00:00
Dockerfile cmd/getgo: initial commit 2017-07-28 18:26:31 +00:00
download_test.go all: fix plan9 build 2017-11-29 20:22:11 +00:00
download.go godoc,cmd/getgo: update download links to dl.google.com 2018-01-25 02:56:30 +00:00
LICENSE cmd/getgo: initial commit 2017-07-28 18:26:31 +00:00
main_test.go all: fix plan9 build 2017-11-29 20:22:11 +00:00
main.go all: fix some staticcheck errors 2020-01-29 04:53:41 +00:00
make.bash cmd/getgo: initial commit 2017-07-28 18:26:31 +00:00
path_test.go all: fix plan9 build 2017-11-29 20:22:11 +00:00
path.go all: fix plan9 build 2017-11-29 20:22:11 +00:00
README.md cmd/getgo: initial commit 2017-07-28 18:26:31 +00:00
steps.go all: fix some staticcheck errors 2020-01-29 04:53:41 +00:00
system_unix.go cmd/getgo: fix build on aix 2019-04-10 13:57:22 +00:00
system_windows.go cmd/getgo: prompt warning if an earlier installation exists 2017-07-31 22:15:19 +00:00
system.go all: fix plan9 build 2017-11-29 20:22:11 +00:00
upload.bash cmd/getgo: initial commit 2017-07-28 18:26:31 +00:00

getgo

A proof-of-concept command-line installer for Go.

This installer is designed to both install Go as well as do the initial configuration of setting up the right environment variables and paths.

It will install the Go distribution (tools & stdlib) to "/.go" inside your home directory by default.

It will setup "$HOME/go" as your GOPATH. This is where third party libraries and apps will be installed as well as where you will write your Go code.

If Go is already installed via this installer it will upgrade it to the latest version of Go.

Currently the installer supports Windows, *nix and macOS on x86 & x64. It supports Bash and Zsh on all of these platforms as well as powershell & cmd.exe on Windows.

Usage

Windows Powershell/cmd.exe:

(New-Object System.Net.WebClient).DownloadFile('https://get.golang.org/installer.exe', 'installer.exe'); Start-Process -Wait -NonewWindow installer.exe; Remove-Item installer.exe

Shell (Linux/macOS/Windows):

curl -LO https://get.golang.org/$(uname)/go_installer && chmod +x go_installer && ./go_installer && rm go_installer

To Do

  • Check if Go is already installed (via a different method) and update it in place or at least notify the user
  • Lots of testing. It's only had limited testing so far.
  • Add support for additional shells.

Development instructions

Testing

There are integration tests in main_test.go. Please add more tests there.

On unix/linux with the Dockerfile

The Dockerfile automatically builds the binary, moves it to /usr/local/bin/getgo and then unsets $GOPATH and removes all $GOPATH from $PATH.

$ docker build --rm --force-rm -t getgo .
...
$ docker run --rm -it getgo bash
root@78425260fad0:~# getgo -v
Welcome to the Go installer!
Downloading Go version go1.8.3 to /usr/local/go
This may take a bit of time...
Adding "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin" to /root/.bashrc
Downloaded!
Setting up GOPATH
Adding "export GOPATH=/root/go" to /root/.bashrc
Adding "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/root/go/bin" to /root/.bashrc
GOPATH has been setup!
root@78425260fad0:~# which go
/usr/local/go/bin/go
root@78425260fad0:~# echo $GOPATH
/root/go
root@78425260fad0:~# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/root/go/bin

Release instructions

To upload a new release of getgo, run ./make.bash && ./upload.bash.