Golang Cheatsheet

Testing

# To get coverage report
# -v is for verbose
go test -v ./... --cover

# To know which lines are covered
go test ./... --coverprofile=coverage.out
go tool cover -html="coverage.out"

Delve debugging

# To print large outputs configure the following
config max-string-len 200000
p string(byteSlice)