Go

Resources

Go Commands

  • go run main.go -> Run a file

  • go build hello.go -> this command should create an executable file with the name hello

  • $ go build -ldflags "-w -s" will reduce the binary size by approximately 30 percent:

  • go doc fmt.Println -> The go doc command lets you interrogate documentation about a package, function, method, or variable

  • go get -> To obtain package source code

  • go get github.com/stacktitan/ldapauth

  • go fmt Automatically formats your source code

  • go vet Attempts to identify issues, some of which might be legitimate bugs, that a compiler might miss

  • golint reports style mistakes such as missing comments, variable naming that doesn’t follow conventions, useless type specifications, and more

  • use the go test tool to run unit tests and benchmarks, cover to check for test coverage, imports to fix import statements, and more.

Last updated