go: only use Go build package if not using the snap
Metadata
Current evaluation
Closed unmerged after maintainers requested more design; Go build-snap handling was later fixed more narrowly by merged PR #2194 (commit 12d9151d3).
Resolution: closed superseded
Reason: PR #2061 was not merged; on April 12, 2018, the author closed it after discussion because the approach needed more design. The underlying behavior was later addressed by merged PR #2194 in commit 12d9151d3.
Evaluated by: mr-cal-bot
No scores available.
Issue body
- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)?
- [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)?
- [x] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh unit`?
-----
This PR makes the Go plugin prefer a Go build snap over Go installed from the archive. A staged Go has preference over both like before. Build packages will still be installed as package installation happens after the plugin initialization, so the right command will be picked afterwards.
A debug message will inform which Go was picked up.
Fixes: [LP: #1616985](https://bugs.launchpad.net/snapcraft/+bug/1616985)
The following new test is being added:
- tests.unit.plugins.go.test_go.GoPluginCommandTest
- To verify that a snap/ build package/ stage go is used respectively, by mocking the existence of the respective files, and that the debug message points at the right path. Also a test to verify that stage packages are preferred.
- Existing tests get mocked to not look for the actual Go that happens to be installed during the test run.
I locally ran the tests:
- `./runtests.sh tests/unit` with unrelated failures in [tests.unit.test_lifecycle.CoreSetupTestCase.test_core_setup_if_docker_env](https://bugs.launchpad.net/snapcraft/+bug/1752576), `tests.unit.test_mangling.TestClearExecstack.test_execstack_clears` and `tests.unit.test_elf`.
- `./runtests.sh tests/integration` with one unrelated failure in [tests.integration.general.test_parser.TestParserWikis](https://bugs.launchpad.net/snapcraft/+bug/1752580)
- `./runtests.sh static`: Everything passed
Manual test steps:
- cd tests/integration/snaps/go-hello
- Update `snapcraft.yaml` by adding this snippet to "go-hello":
build-snaps:
- go
- snapcraft -d
- Observe that the build proceeds and a message is logged saying that `/snap/bin/go` is used.
- Undo the YAML changes by removing build-snaps and `sudo snap remove go`.
- snapcraft -d
- Observe that the build succeeds and a message is logged saying "go" is used.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed superseded | Closed unmerged after maintainers requested more design; Go build-snap handling was later fixed more narrowly by merged PR #2194 (commit 12d9151d3). | |
| stealth/space-bunny-alpha | — | closed stale | Closed unmerged in 2018 pending further design; a later, narrower Go build-snap fix merged in #2194 at commit 12d9151d3. | |
| stealth/space-bunny-alpha | — | closed stale | Closed unmerged after design concerns; later PR #2194 addressed Go build-snap/deb conflicts in commit 12d9151d3. | |
| stealth/space-bunny-alpha | — | closed stale | PR #2061 was closed unmerged after review. The maintainer said the proposed preference for a Go build snap needed further design before proceeding. | |
| qwen/qwen3.6-35b-a3b | — | — | Abandoned without merging. The author withdrew the Go plugin changes after offline discussions determined the implementation required further design review before proceeding. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed and abandoned by the author. Offline discussions determined the Go plugin priority changes require further design review before implementation. |
Update history
No update history recorded yet.
Related work
-
Superseded By:
snapcraft#2194
(confidence 99%)
Merged commit 12d9151d3 skipped legacy Go debs when a Go build snap was specified.
-
Related To:
snapcraft#1751
(confidence 98%)
Tracks the underlying Go build-snap issue also associated with LP #1616985.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1616985 the go plugin doesn't use go build-snaps | snapcraft (launchpad) | closed | Fixed by merged PR snapcore/snapcraft#2194 (commit 12d9151d3): the Go plugin now skips golang-go when a go build-snap is configured. | |
| #1751 the go plugin doesn't use go build-snaps | snapcraft | closed | Fixed in canonical/snapcraft#2194 (commit 12d9151d3): the Go plugin now skips legacy golang-go DEBs when a Go build snap is configured. |