You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.5 KiB

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