go module plugin assumes go files are in root of part source
Metadata
Current evaluation
⚠️ This summary may be outdated — the issue content or evaluation prompts have changed since this evaluation was made.
Closed without a fix. The author provided a workaround using override-build, but the Go plugin was never updated to handle cmd/ subdirectories. The request was effectively abandoned.
Suggested action: —
No scores available.
Issue body
The go plugin has been updated to support go modules, which is great, however its mechanism to build binaries is a bit weird. It seems like it runs:
```
go build -o $SNAPCRAFT_PART_INSTALL/bin
```
which doesn't do anything when your go code is organized underneath a cmd/ directory as is very common with go projects. I can build individual binaries by setting `source-subdir: cmd/command1` and just creating duplicate parts with the same source and different source-subdirs, but this feels duplicative and wasteful.
Is there a better way to build such go binaries? In the meantime, I've fallen back to building like so:
```yaml
parts:
influxproxy:
source: .
plugin: go
build-packages: [mercurial, git, build-essential]
override-build: |
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
cd $SNAPCRAFT_PART_SRC
go build -o $SNAPCRAFT_PART_INSTALL/bin/thing1 ./cmd/thing1
go build -o $SNAPCRAFT_PART_INSTALL/bin/thing2 ./cmd/thing2
```
which is better than the old behavior which didn't support modules properly.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Closed without a fix. The author provided a workaround using override-build, but the Go plugin was never updated to handle cmd/ subdirectories. The request was effectively abandoned. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without comments or resolution, the go plugin cmd/ directory limitation was likely abandoned. The author provided a custom override-build workaround, but no official fix or update was implemented. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without resolution. The go plugin behavior remains unchanged, assuming source files are at the project root and failing for standard cmd/ directory layouts. No fix or workaround was implemented. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1613779 go plugin ignores the source-subdir keyword | snapcraft (launchpad) | open | Go plugin (snapcraft 1.x) ignored source-subdir, symlinking GOPATH to git root instead of the subdirectory. 10 years old, 0 comments, no maintainer interaction. The GOPATH-symlink approach and go-importpath key no longer exist in the modern go plugin. | |
| #978 `go-use` plugin doesn't respect `source-subdir` | craft-parts | closed | Closed without resolution. Only an automated Jira sync comment exists, with no developer response or code changes, indicating the bug was deferred or abandoned. |