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 version

🗂 Modules & Project Init

1

Initialize a module (creates go.mod)

mkdir myapp && cd myapp
go mod init example.com/myapp
go get
2

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 all

Last updated