Learning GO programming.
Download GO : https://golang.org/dl/
Effective GO Documentation : https://golang.org/doc/effective_go#introduction
How Do You Structure Your Go Apps : https://oreil.ly/0zHY4
FOSS - Open Source Licenses : https://oreil.ly/KVlrd
Profiling GO : https://oreil.ly/HHe9c
Type Parameters-Draft Design : https://oreil.ly/POhSg
VSCode Extension :
- GO
- Open Command Palette and search GO Tools. Install all tools listed .
go version
- To check GO version.go env
- To check GO environment config.go run
- Compile code into binary in temporary directory. Once execution completed, will delete the binary.go build
- Build binary for later use. Creates executable .exe file.go install
- Takes an argument(source code repository) followed by an @ plus the version of the tool. It then downloads, compiles, and install into $GOPATH/bin direrctory.go fmt
- Automatically reformat codes to match the standard format.go mod init <repo>
- Modules initializationgo doc PACKAGE_NAME.IDENTIFIER_NAME
- To display documentation for specific identifier in the package.go list -m -versions MODULE_PATH
- To check versions of the module available.go get MODULE_PATH@VERSION
- To upgrade module version.go get -u=patch MODULE_PATH
- To upgrade patch version for the same module version.go mod tidy
- To remove unused versions.go mod vendor
- To create vendor directory contains all of modules dependencies.go test
- To run test and generate report.go test -v -cover -coverprofile=c.out
- Calculates coverage information and includes summary in the test output and save into a file.go tool cover -html=c.out
- Generates HTML representation of the source code.go test -bench=. -benchmem
- Run all benchmarks and includes memory allocation information.go test -race
- Concurrency race checker.
- hey - Load tests HTTP servers.
go install github.com/rakyll/hey@latest
- goimports - Enhanced version of
go fmt
which also cleans up import statements.
go install golang.org/x/tools/cmd/goimport@latest.
go imports -l -w ."-l" = prints the file with incorrect formatting.
"-w"= modify the files in place.
"." = specifies the file to be scanned which in this case is everything in the current directory and all of its subdirectory.
- golint & go vet - To ensure the code follows sytle guidelines.
go install golang.org/x/lint/golint@latest.
golint ./...
go vet ./...
- golangci-lint - Combined tools for
golint
,go vet
and set of other code quality tools.
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest.
golangci-lint run.To configure, go to root project and find .golangci.yml.
Documentation: https://oreil.ly/vufj1
- shadow - To detect shadowed variables. Include shadow in vet task in Makefile.
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest shadow ./...
- wire - A dependency injection helper.
go get github.com/google/wire/cmd/wire
Documentation: https://github.com/google/wire