Go Commands¶
Build / Compile / Run¶
Compile, execute and delete the binary:
go run main.go
Build binary:
go build main.go
Note
Rename binary with -o <name>
flag:
Run binary:
./main
Download Packages:
go install github.com/rakyll/hey@latest
Note
Change Version with @<version>
Linting / Formatting¶
Format Code:
go fmt
Group Imports:
goimports -l -w
Lint Code:
golint ./...
Vet Code:
Syntax is correct but may have other issues
go vet ./...
All in one Linting:
golangci-lint run