Skip to content

Instantly share code, notes, and snippets.

@danielalvarenga
Created May 19, 2022 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielalvarenga/f49ebb6390b8f06dfc8331919c5a851e to your computer and use it in GitHub Desktop.
Save danielalvarenga/f49ebb6390b8f06dfc8331919c5a851e to your computer and use it in GitHub Desktop.
Golang tests commands

Golang tests commands

Run tests:

go test

Run verbose tests:

go test -v

Run tests from all subdirectories:

go test ./...

Run tests showing the coverege:

go test -cover

Run tests creating a external file with coverege details:

go test -coverprofile=coverege-file.out

Reading the coverege file to show details on the terminal:

go tool cober -func=coverege-file.out

Reading the coverege file to show details in html:

go tool cover -html=coverege-file.out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment