ci: enforce >=90% line coverage on go_test targets#382
Merged
Conversation
Adds a separate Go coverage gate so Go production code under tools/go/ is held to the same >=90% line-coverage bar as the Kotlin cli/src/main sources, gated independently so thin coverage in one language can't hide behind the other. - MODULE.bazel: add rules_go/gazelle + a hermetic Go SDK (dev_dependency, so consumers don't inherit them via MVS), matching the nested test-resource workspace versions. - tools/go/sample: a tiny go_library + go_test that exercises the gate end-to-end (and keeps it green until real Go code lands). - ci.yaml: include //tools/go/... in the coverage run and add a step that runs //tools:coverage-check with --include tools/go/ --threshold 90. - Makefile + README/template: document and mirror the Go gate locally. The existing language-agnostic LCOV checker (tools/coverage_check.py) is reused unchanged; rules_go emits workspace-relative SF: paths (tools/go/.../*.go) that the --include prefix scopes cleanly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds coverage enforcement for
go_testtargets. Go production code undertools/go/is now held to a 90% line-coverage bar, enforced in CI — gated independently of the existing Kotlin gate so thin coverage in one language can't hide behind well-covered code in the other.This is groundwork for Go tooling landing under
tools/go/soon; the enforcement is live today against a sample target.How
The existing LCOV checker (
tools/coverage_check.py) is already language-agnostic — it scopes a combined LCOV report by path prefix.rules_goemits workspace-relativeSF:paths (tools/go/.../*.go), so the gate is just a second invocation of the same binary with a Go-scoped--include.MODULE.bazel— addrules_go 0.60.0+gazelle 0.45.0+ a hermetic Go SDK (go_sdk.download(version = "1.23.1")), alldev_dependency = True(matching the existingrules_python/rules_nodejspattern) so module consumers don't inherit them via MVS. Versions match the nestedgo_mod_changetest-resource workspace.tools/go/sample/— a tinygo_library+go_test(100% covered) that exercises the gate end-to-end and keeps it green until real Go code lands. Replace/extend with real code undertools/go/..github/workflows/ci.yaml— include//tools/go/...in thebazel coveragerun; add an "Enforce Go coverage threshold" step running//tools:coverage-check -- --include tools/go/ --threshold 90.Makefile+README.md/tools/readme_template.md— mirror and document the Go gate locally (make coveragenow runs both gates).Validation
bazel coverage //tools/go/...emitsSF:tools/go/sample/sample.go— confirmed thetools/go/prefix matches and cleanly excludes the Pythontools/coverage_check.py.Notes
tools/go/ever contains zero instrumentable Go code ("no instrumented production-source lines"). The sample prevents that — keep at least one real Go target undertools/go/.🤖 Generated with Claude Code