1
0
mirror of https://github.com/golang/go synced 2024-09-30 18:28:32 -06:00
go/cmd/getgo
Brad Fitzpatrick 36c7af3342 all: fix plan9 build
getgo doesn't work on plan9. Skip it entirely.

And skip the massive slow godoc start-up test. Not worth it.

Change-Id: If062b7c4c8c7c5084e607ed22085657054c10ba9
Reviewed-on: https://go-review.googlesource.com/80737
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-29 20:22:11 +00:00
..
server cmd/getgo: fix builds 2017-07-31 18:28:23 +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 all: fix plan9 build 2017-11-29 20:22:11 +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 plan9 build 2017-11-29 20:22:11 +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 plan9 build 2017-11-29 20:22:11 +00:00
system_unix.go cmd/getgo: prompt warning if an earlier installation exists 2017-07-31 22:15:19 +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.