go test
Tests Go packages (files have to end with _test.go).
More information: https://golang.org/cmd/go/#hdr-Testing_flags.
-
Test the package found in the current directory:
go test -
[v]erbosely test the package in the current directory:
go test -v -
Test the packages in the current directory and all subdirectories (note the
...):
go test -v ./... -
Test the package in the current directory and run all benchmarks:
go test -v -bench . -
Test the package in the current directory and run all benchmarks for 50 seconds:
go test -v -bench . -benchtime {{50s}} -
Test the package with coverage analysis:
go test -cover
License and Disclaimer
The content on this page is copyright © 2014—present the tldr-pages team and contributors.This page is used with permission under Creative Commons Attribution 4.0 International License.
While we do attempt to make sure content is accurate, there isn't a warranty of any kind.