-
Notifications
You must be signed in to change notification settings - Fork 6
Installing Go
zelenko edited this page Mar 22, 2024
·
16 revisions
- http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang/
- https://www.youtube.com/playlist?list=PLSak_q1UXfPrI6D67NF8ajfeJ6f7MH83S Learn To Code - Golang Training
- https://exercism.org/tracks/go/exercises
- https://golang.org/pkg/html/template/
- https://www.youtube.com/watch?v=PZTnp8rDnl0 Web Programming with the Go Programming Language
- https://devhints.io/go Go cheatsheet
export GOPATH=/var/go/web/
echo $GOPATH
GOOS=linux GOARCH=amd64 go build -o web
set GOARCH=amd64
set GOARCH=386
set GOOS=linux
set GOOS=windows
echo %GOROOT%
go build -o hello.exe hello.go
List of GOOS/GOARCH supported by Go
cd /usr/local
curl -LO https://redirector.gvt1.com/edgedl/go/go1.9.2.linux-amd64.tar.gz
shasum -a 256 go1.9.2.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.9.2.linux-amd64.tar.gz
vi ~/.profile
export PATH=$PATH:/usr/local/go/bin
export GOROOT=/usr/local/go
export GOPATH=/var/go
export GOPROXY=https://proxy.golang.org,direct
source ~/.profile
echo $GOROOT
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$GOPATH/bin
export GOPROXY=https://proxy.golang.org,direct
# $GOPATH has bin, pkg sub-directories.
export GOPATH='/home/username/go'
# $GOROOT/src is where the source code for the standard library lives.
export GOROOT='/usr/lib/golang'
export PATH
unset USERNAME
After downloading and installing, specify where the code is stored in system variable. CLI command: set GOPATH=F:\GoCode
Check existing variables go env
. Check current version go version
.
To install and run tools, $GOPATH/bin
must be added to $PATH
.
go install golang.org/x/tools/cmd/goimports@latest
go install golang.org/x/tools/cmd/present@latest
-
go install golang.org/x/tools/cmd/godoc@latest
godoc -http :8080
go install golang.org/x/tools/cmd/gonew@latest
go install golang.org/x/lint/golint@latest
go install github.com/cortesi/modd/cmd/modd@latest
go install github.com/mgechev/revive@latest