Skip to content

Commit 1f59d07

Browse files
committed
clarify gotchas about -vet flag
1 parent 7ab7d10 commit 1f59d07

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3729,7 +3729,7 @@ Ginkgo supports `--race` to analyze race conditions, `--cover` to compute code c
37293729

37303730
`ginkgo -race` runs the race detector and emits any detected race conditions as the suite runs. If any are detected the suite is marked as failed.
37313731

3732-
`ginkgo -vet` allows you to configure the set of checks that are applied when your code is compiled. `ginkgo` defaults to the set of default checks that `go test` uses and you can specify additional checks by passing a comma-separated list to `--vet`. The set of available checks can be found by running `go doc cmd/vet`.
3732+
`ginkgo -vet=comma,separated,list` allows you to configure the set of checks that are applied when your code is compiled. If you pass in an empty list with `ginkgo --vet=""`, `ginkgo` defaults to the set of default checks that `go test` uses. The set of available checks can be found by running `go doc cmd/vet`.
37333733

37343734
#### Computing Coverage
37353735
`ginkgo -cover` will compute and emit code coverage. When running multiple suites Ginkgo will emit coverage for each suite and then emit a composite coverage across all running suites. As with `go test` the default behavior for a given suite is to measure the coverage it provides for the code in the suite's package - however you can extend coverage to additional packages using `--coverpkg`. You can provide a comma-separated list of package names (as they appear in `import` statements) or a relative path. You can also use `...` for recursion. For example, say we have a package called "github.com/foo/bar". The following are equivalent:

types/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ var GoBuildFlags = GinkgoFlags{
523523
{KeyPath: "Go.Race", Name: "race", SectionKey: "code-and-coverage-analysis",
524524
Usage: "enable data race detection. Supported on linux/amd64, linux/ppc64le, linux/arm64, linux/s390x, freebsd/amd64, netbsd/amd64, darwin/amd64, darwin/arm64, and windows/amd64."},
525525
{KeyPath: "Go.Vet", Name: "vet", UsageArgument: "list", SectionKey: "code-and-coverage-analysis",
526-
Usage: `Configure the invocation of "go vet" during "go test" to use the comma-separated list of vet checks. If list is empty, "go test" runs "go vet" with a curated list of checks believed to be always worth addressing. If list is "off", "go test" does not run "go vet" at all. Available checks can be found by running 'go doc cmd/vet'`},
526+
Usage: `Configure the invocation of "go vet" during "go test" to use the comma-separated list of vet checks. If list is empty (by explicitly passing --vet=""), "go test" runs "go vet" with a curated list of checks believed to be always worth addressing. If list is "off", "go test" does not run "go vet" at all. Available checks can be found by running 'go doc cmd/vet'`},
527527
{KeyPath: "Go.Cover", Name: "cover", SectionKey: "code-and-coverage-analysis",
528528
Usage: "Enable coverage analysis. Note that because coverage works by annotating the source code before compilation, compilation and test failures with coverage enabled may report line numbers that don't correspond to the original sources."},
529529
{KeyPath: "Go.CoverMode", Name: "covermode", UsageArgument: "set,count,atomic", SectionKey: "code-and-coverage-analysis",

types/errors.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ func (g ginkgoErrors) ExpectFilenameNotPath(flag string, path string) error {
639639
func (g ginkgoErrors) FlagAfterPositionalParameter() error {
640640
return GinkgoError{
641641
Heading: "Malformed arguments - detected a flag after the package liste",
642-
Message: "Make sure all flags appear {{bold}}after{{/}} the Ginkgo subcommand and {{bold}}before{{/}} your list of packages (or './...').\n{{gray}}e.g. 'ginkgo run -p my_package' is valid but `ginkgo -p run my_package` is not.\n{{gray}}e.g. 'ginkgo -p -vet ./...' is valid but 'ginkgo -p ./... -vet' is not{{/}}",
642+
Message: "Make sure all flags appear {{bold}}after{{/}} the Ginkgo subcommand and {{bold}}before{{/}} your list of packages (or './...').\n{{gray}}e.g. 'ginkgo run -p my_package' is valid but `ginkgo -p run my_package` is not.\n{{gray}}e.g. 'ginkgo -p -vet="" ./...' is valid but 'ginkgo -p ./... -vet=""' is not{{/}}",
643643
}
644644
}
645645

0 commit comments

Comments
 (0)