Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go: rename option to --go-test-coverage-packages #17795

Merged
merged 1 commit into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/python/pants/backend/go/goals/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def compilation_failure(exit_code: int, stdout: str | None, stderr: str | None)
build_opts,
coverage_config=GoCoverageConfig(
cover_mode=go_test_subsystem.coverage_mode,
import_path_include_patterns=go_test_subsystem.coverage_include_patterns,
import_path_include_patterns=go_test_subsystem.coverage_packages,
),
)

Expand Down
7 changes: 5 additions & 2 deletions src/python/pants/backend/go/subsystems/gotest.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ class GoTestSubsystem(Subsystem):
),
)

coverage_include_patterns = StrListOption(
coverage_packages = StrListOption(
default=[],
help=softwrap(
"""
A list of import path patterns for determining which import paths will be instrumented for code
A list of "import path patterns" for determining which import paths will be instrumented for code
coverage.

From `go help packages`:
Expand All @@ -118,6 +118,9 @@ class GoTestSubsystem(Subsystem):
is not a vendored package: cmd/vendor would be a command named vendor,
and the pattern cmd/... matches it.
See golang.org/s/go15vendor for more about vendoring.

This option is similar to the `go test -coverpkg` option, but without support currently
for reserved import path patterns like `std` and `all`.
"""
),
)
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/backend/go/util_rules/coverage_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def run_test(tgt: Target) -> str:
[
"--go-test-args=-v -bench=.",
"--test-use-coverage",
"--go-test-coverage-include-patterns=foo/adder",
"--go-test-coverage-packages=foo/adder",
],
env_inherit={"PATH"},
)
Expand Down