Golang
Install and manage Go locally (Windows, macOS, Linux) using official archives or package managers; manage modules with go mod.
🧾 Overview
Go (Golang) is a compiled language suited for APIs, workers, CLIs and concurrent services. Local installation lets you build and test binaries before deploying.
📥 Installation (choose one)
1
Download the Windows .msi from https://go.dev/dl/
2
Run it (adds Go to PATH).
3
Reopen terminal (PowerShell / CMD).
4
Verify:
go versionscoop install go
go version# Replace version as needed
curl -LO https://go.dev/dl/go1.22.6.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.22.6.linux-amd64.tar.gz
export PATH="/usr/local/go/bin:$PATH"
go versionsudo apt update
sudo apt install -y golang-go
go versionsudo dnf install -y golang
go versionsudo pacman -S --needed go
go versionDownload the .pkg from https://go.dev/dl/ then:
go versionbrew update
brew install go
go versioncurl -LO https://go.dev/dl/go1.22.6.darwin-arm64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.22.6.darwin-arm64.tar.gz
export PATH="/usr/local/go/bin:$PATH"
go version🗂 Modules & Project Init
1
Initialize a module (creates go.mod)
mkdir myapp && cd myapp
go mod init example.com/myapp
go get2
Add a file main.go
package main
import "fmt"
func main() { fmt.Println("hello") }3
Run
go run .4
Build
go build -o app🔄 Updating
Task
Command
Tidy modules
go mod tidy
Update deps (minor/patch)
go get -u ./...
Update single module
go get -u module/name
Verify modules
go mod verify
🗃 Common Commands
go mod init example.com/project
go mod tidy
go run .
go build -o bin/app
go test ./...
go list -m allLast updated