To run unit tests:
go test ./... -v
To run linter:
go vet ./...
# command returns exit code 1 if code is not correctly formatted - https://circleci.com/blog/enforce-build-standards/
'! go fmt ./... 2>&1 | read'
To run race detector:
go test -race ./...
To test code coverage (will output report as .html
file):
go test -covermode=atomic -coverprofile=coverage.out ./...
go tool cover -html coverage.out -o coverage.html
go tool cover -func=coverage.out