Jump to content

Go

From Smithnet Wiki
Revision as of 20:02, 23 January 2026 by NickPGSmith (talk | contribs)

Building and Packages

go run test.go
go build test.go

If there are multiple files in the main package, must make go access all of them:

go run .
go build .


gofmt -w .
gofmt -d test.go

Initialise project, create go.mod file:

go mod init example-project

Download, and add reference to go.mod file:

go get github.com/alexflint/go-arg

Ensure go.mod is in sync with code imports:

go mod tidy

Note the go.sum file that contains anti-tampering checksums.

Useful Packages