1 | # getgo |
---|---|
2 | |
3 | A proof-of-concept command-line installer for Go. |
4 | |
5 | This installer is designed to both install Go as well as do the initial configuration |
6 | of setting up the right environment variables and paths. |
7 | |
8 | It will install the Go distribution (tools & stdlib) to "/.go" inside your home directory by default. |
9 | |
10 | It will setup "$HOME/go" as your GOPATH. |
11 | This is where third party libraries and apps will be installed as well as where you will write your Go code. |
12 | |
13 | If Go is already installed via this installer it will upgrade it to the latest version of Go. |
14 | |
15 | Currently the installer supports Windows, \*nix and macOS on x86 & x64. |
16 | It supports Bash and Zsh on all of these platforms as well as powershell & cmd.exe on Windows. |
17 | |
18 | ## Usage |
19 | |
20 | Windows Powershell/cmd.exe: |
21 | |
22 | `(New-Object System.Net.WebClient).DownloadFile('https://get.golang.org/installer.exe', 'installer.exe'); Start-Process -Wait -NonewWindow installer.exe; Remove-Item installer.exe` |
23 | |
24 | Shell (Linux/macOS/Windows): |
25 | |
26 | `curl -LO https://get.golang.org/$(uname)/go_installer && chmod +x go_installer && ./go_installer && rm go_installer` |
27 | |
28 | ## To Do |
29 | |
30 | * Check if Go is already installed (via a different method) and update it in place or at least notify the user |
31 | * Lots of testing. It's only had limited testing so far. |
32 | * Add support for additional shells. |
33 | |
34 | ## Development instructions |
35 | |
36 | ### Testing |
37 | |
38 | There are integration tests in [`main_test.go`](main_test.go). Please add more |
39 | tests there. |
40 | |
41 | #### On unix/linux with the Dockerfile |
42 | |
43 | The Dockerfile automatically builds the binary, moves it to |
44 | `/usr/local/bin/getgo` and then unsets `$GOPATH` and removes all `$GOPATH` from |
45 | `$PATH`. |
46 | |
47 | ```bash |
48 | $ docker build --rm --force-rm -t getgo . |
49 | ... |
50 | $ docker run --rm -it getgo bash |
51 | root@78425260fad0:~# getgo -v |
52 | Welcome to the Go installer! |
53 | Downloading Go version go1.8.3 to /usr/local/go |
54 | This may take a bit of time... |
55 | Adding "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin" to /root/.bashrc |
56 | Downloaded! |
57 | Setting up GOPATH |
58 | Adding "export GOPATH=/root/go" to /root/.bashrc |
59 | 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 |
60 | GOPATH has been setup! |
61 | root@78425260fad0:~# which go |
62 | /usr/local/go/bin/go |
63 | root@78425260fad0:~# echo $GOPATH |
64 | /root/go |
65 | root@78425260fad0:~# echo $PATH |
66 | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/root/go/bin |
67 | ``` |
68 | |
69 | ## Release instructions |
70 | |
71 | To upload a new release of getgo, run `./make.bash && ./upload.bash`. |
72 |
Members