Environment Setup
Go is configured system-wide in /etc/profile
:
export PATH=$PATH:/usr/local/go/bin
Optional (if you want Go-installed binaries accessible globally):
export GOPATH=/root/go
export PATH=$PATH:$GOPATH/bin
Apply immediately:
source /etc/profile
Workspace Layout
/root/go/bin
→ binaries installed viago install
(not in PATH unless you add it)/root/go/pkg
→ compiled package cache/root/go/src
→ source code
Useful Commands
- go version → check version
- go env → inspect environment
- go run → run a program
- go build → compile
- go install → install