snippetbashTip
go test — Test Go packages (files have to end with `_test.go`). More information: <https://pkg.go.dev/cmd/go#h
Viewed 0 times
commandgo testfilesendclitesthavepackages
Problem
How to use the
go test command: Test Go packages (files have to end with _test.go). More information: <https://pkg.go.dev/cmd/go#hdr-Testing_flags>.Solution
go test — Test Go packages (files have to end with _test.go). More information: <https://pkg.go.dev/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 -vTest 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 50sTest the package with coverage analysis:
go test -coverCode Snippets
Test the package found in the current directory
go test[v]erbosely test the package in the current directory
go test -vTest 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 50sContext
tldr-pages: common/go test
Revisions (0)
No revisions yet.