← Back to issue list

feat(go): Add `enable-check` build attribute and `go-testtags` property to run tests during build

View original Github issue

Metadata

Project
craft-parts
Number
#1494
Type
pull request
State
open
Author
Copilot
Labels
—
Created
Updated
Closed
—

Current evaluation

Adds opt-in Go build-time tests and test-specific build tags, with docs and unit/integration coverage. Canonical CLA passes, but two reviewers requested changes and 26 comments remain unresolved.

Suggested action: keep open

Reason: The implementation addresses open issue #1493 and CLA passes with no pending or failing checks. However, the review state remains changes_requested by two reviewers with 26 unresolved comments, including a request for integration coverage that the author says was addressed in commit 3794057; re-review and resolution of the remaining feedback are still needed.

Evaluated by: mr-cal-bot

Impact: 45 Quick Win: 8 Complexity: 32 Confidence: 91 Actionability: 25

Issue body

Adds support for running unit tests as part of the Go plugin build step, along with a new `go-testtags` property for passing test-specific build tags to `go test`. ## Changes Made - **`enable-check` build attribute**: When set in `build-attributes`, the plugin appends a `go test ./...` command after `go install`, running unit tests as part of the build step. - **`go-testtags` plugin property**: A new list-of-strings property analogous to `go-buildtags`, but used specifically for `go test`. The tags passed to `go test` are the union of `go-buildtags` and `go-testtags`; `go install` continues to use only `go-buildtags`. - **`plugins.py`**: Added `"enable-check"` to `PLUGINS_BUILD_ATTRIBUTES`. - **`go_plugin.py`**: Added `supported_build_attributes()` returning `{"enable-check"}`; added `go_testtags` field to `GoPluginProperties`; updated `get_build_commands()` to compute separate tag strings for install and test. - **`go_plugin.rst`**: Added `go-testtags` key section; added `enable-check` attribute section; updated "How it works" to describe both tag lists being combined for `go test`. - **Unit tests** (`test_go_plugin.py`): Added cases for `enable-check` with no tags, with `go-buildtags` only, with `go-testtags` only, and with both combined. - **Integration tests** (`test_go.py`): Added `test_go_enable_check` (passing tests succeed) and `test_go_enable_check_failing_test` (failing tests raise `PluginBuildError` with `"go test"` confirmed in the shell trace captured in `stderr`). <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>go plugin: Add flag to run tests during build phase</issue_title> > <issue_description>### What needs to get done > > Add support to the go plugin for a `enable-checks` build attribute. When enabled, the final build command executed by the plugin should be `go test` with the proper arguments to run unit tests on the build artifact. Add a test case for the go plugin to confirm the new final command is added. Update the build attributes section of the go plugin documentation to describe the new parameter. > > ### Why it needs to get done > > Users should be able to run unit tests as part of their build without needing to specify an `override-build` script.</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes canonical/craft-parts#1493 <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 45
Quick Win: 8
Complexity: 32
Confidence: 91
Actionability: 25
keep open Adds opt-in Go build-time tests and test-specific build tags, with docs and unit/integration coverage. Canonical CLA passes, but two reviewers requested changes and 26 comments remain unresolved.
qwen/qwen3.6-35b-a3b
Impact: 55
Quick Win: 10
Complexity: 40
Confidence: 55
Actionability: 30
needs review Adds enable-check build attribute and go-testtags property to Go plugin for running tests during build. Has 26 unresolved review comments, changes_requested status, 166 days of inactivity.
qwen/qwen3.8-27b
Impact: 45
Quick Win: 27
Staleness: 50
Complexity: 40
Confidence: 80
needs review Adds enable-check build attribute and go-testtags property to the go plugin to run unit tests during build, with docs and tests. Review status changes_requested (2 reviewers, 26 unresolved comments); author added requested integration tests 145 days ago.
qwen/qwen3.6-35b-a3b
Staleness: 55
Complexity: 45
Confidence: 80
needs review Adds enable-check build attribute and go-testtags property to run Go unit tests during build. Currently in changes_requested state with 26 unresolved review comments.
qwen3.6-35b-a3b-mtp-q6
Staleness: 45
Complexity: 30
Confidence: 85
needs review Adds enable-check build attribute and go-testtags property to the Go plugin for running unit tests during build. Includes code changes, documentation, and tests. Currently awaiting maintainer review.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/craft-parts#1493 (confidence 100%)

    The PR explicitly says it fixes this still-open feature request to run Go tests during the build phase.

Related issues

Issue Project State Summary Similarity
#1493 go plugin: Add flag to run tests during build phase craft-parts open Maintainer-filed feature request to add an `enable-checks` build attribute to the go plugin so `go test` runs as the final build command, plus a test and docs update. Unimplemented, unlabelled, no discussion.
71%