go plugin ignores the source-subdir keyword
Metadata
Current evaluation
Legacy Go plugin ignored source-subdir; later Go-module support replaced the GOPATH workflow and current craft-parts honors the configured source subtree.
Suggested action: close resolved
Reason: The 2017 maintainer response explicitly acknowledged that Snapcraft ignored source-subdir. Commit dd7431146 (snapcraft#2962) later added Go-module support for a main package outside the repository root, and current craft-parts derives the build location from source_subdir before running Go builds.
Evaluated by: mr-cal-bot
Impact:
42
Quick Win:
21
Complexity:
45
Confidence:
92
Actionability:
91
Issue body
When using 'source', the go plugin assumes source is in the git root dir.
Sample snapcraft.yaml of project that shows this below.
The go plugin attempts to symlink in the source from the local cloned repo, but makes an assumption that the root of the git repo holds the source. In the below case the real source to build is at 'src/cmd/frps' within the git repo.
Here's the symlink created:
jgrimm@jgrimm-ThinkPad-X250:~/snapit/frps/parts/frps/go/src/github.com/fatedier/frp/src/cmd$ ll
total 12
drwxr-xr-x 2 jgrimm lxd 4096 Aug 16 10:24 ./
drwxr-xr-x 3 jgrimm lxd 4096 Aug 16 10:24 ../
lrwxrwxrwx 1 jgrimm lxd 39 Aug 16 10:24 frps -> /home/jgrimm/snapit/frps/parts/frps/src/
Instead that frps link should be to /home/jgrimm/snapit/frps/parts/frps/src/src/cmd/frps/
--- snapcraft.yaml ---
name: frps
version: "0.8"
summary: frps - short text
description: |
FIXME:
confinement: devmode
apps:
frps:
command: bin/frps
plugs: [network, network-bind]
parts:
frps:
plugin: go
source: https://github.com/fatedier/frp.git
go-importpath: github.com/fatedier/frp/src/cmd/frps
build-packages: [git]
---
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha |
Impact:
42
Quick Win:
21
Complexity:
45
Confidence:
92
Actionability:
91
|
close resolved | Legacy Go plugin ignored source-subdir; later Go-module support replaced the GOPATH workflow and current craft-parts honors the configured source subtree. | |
| stealth/space-bunny-alpha |
Impact:
30
Quick Win:
19
Complexity:
30
Confidence:
94
Actionability:
90
|
close resolved | The legacy Go plugin’s GOPATH symlink ignored source-subdir; commit 890de44e replaced that workflow, and current builds honor the configured source subtree. | |
| qwen/qwen3.6-35b-a3b |
Impact:
30
Quick Win:
15
Complexity:
30
Confidence:
60
Actionability:
70
|
keep open | The go plugin ignores the source-subdir keyword, assuming source is in the git root dir. Code inspection shows the go plugin does not use part_src_subdir for build directory setup. | |
| qwen/qwen3.8-27b |
Impact:
20
Quick Win:
14
Staleness:
95
Complexity:
30
Confidence:
80
Support Request:
15
|
close stale | 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. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
95
Complexity:
35
Confidence:
80
Support Request:
10
|
close stale | The go plugin in snapcraft incorrectly ignores the source-subdir keyword, creating symlinks to the git root instead of the specified subdirectory. The report lacks maintainer feedback and is over nine years old. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
98
Complexity:
45
Confidence:
90
Support Request:
5
|
close stale | The go plugin incorrectly ignores the source-subdir keyword when creating symlinks, assuming source is always in the git root. The report is over 9 years old with no maintainer response. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
98
Complexity:
40
Confidence:
92
Support Request:
10
|
close stale | Go plugin ignores source-subdir, creating incorrect symlinks. Issue is over 9 years old with zero maintainer interaction. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
snapcraft#2962
(confidence 92%)
Resolving commit dd7431146 added Go-module support for main packages not located at the repository root.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #978 `go-use` plugin doesn't respect `source-subdir` | craft-parts | closed | go-use was fixed to honor source-subdir by merged PR canonical/craft-parts#980 (commit 314bab9f); the change shipped in craft-parts 2.4.0. | |
| #1591565 go plugin is not striping the .git from the source | snapcraft (launchpad) | open | The 2016 GOPATH-era Go plugin treated a .git-suffixed source directory as a package path; the current module-based implementation no longer does so, with the transition recorded in craft-parts#313. |