Install Go
- Download the latest Go from go.dev/dl (current: Go 1.26.0 or later).Linux/macOS:
wget https://go.dev/dl/go1.26.0.linux-amd64.tar.gz # Adjust version/OS
sudo tar -C /usr/local -xzf go1.26.0.linux-amd64.tar.gz
mkdir -p ~/go/{bin,src,pkg}
export PATH=$PATH:/usr/local/go/bin
Add to ~/.bashrc or ~/.zshrc.
Windows: Run MSI installer, verify PATH.
-
Verify: go version
-
Hello World:
mkdir hello
cd hello
go mod init hello
go.mod created
echo 'package main
import "fmt"
func main() { fmt.Println("Hello, Go!") }' > hello.go
go run .
This builds a strong foundation for coding.