Common Go commands for building and cross-compiling pentesting tools.
A lot of modern offensive tooling is written in Go, so it’s worth knowing the handful of go commands needed to build and tweak it yourself.
go run main.go # Run a Go file directly without producing a binarygo build main.go # Compile a Go file into a binarygo build -ldflags "-w -s" main.go # Build a smaller binary by stripping debug symbols and the symbol table# Cross-compile on Windows to produce a Linux binary$env:GOOS = "linux"$env:GOARCH = "amd64"go build -ldflags "-w -s" main.gogo doc fmt.Println # Show documentation for a package, function or methodgo fmt main.go # Reformat a Go file to the standard style



