← Back to issue list

Go plugin breaks with snapcraft.yaml in tree

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1590108
Type
issue
State
closed
Author
~niemeyer
Labels
—
Created
Updated
Closed

Current evaluation

Fixed by hard-linking local sources instead of symlinking them, preventing recursive GOPATH traversal; merged in snapcore/snapcraft#622 (commit a07fa0faa).

Resolution: closed resolved

Reason: Maintainer kyrofa linked the resolution to snapcore/snapcraft#622. Commit a07fa0faa, "Hard-link local sources instead of symlinking them," directly fixes the recursion.

Evaluated by: mr-cal-bot

No scores available.

Issue body

The Go plugin breaks if snapcraft.yaml is inside the Go project tree itself. Problem is this: $GOPATH is set to parts/myproject/go, source code is symlinked into parts/myproject/go/myproject pointing to the root of myproject. Root of myproject contains parts/myproject/go. That means there's an infinite recursion, and when the Go snapcraft plugin attempts to build go get -t -d ./myproject/... it explodes in all kinds of funny ways because it recursively finds the $GOPATH source code again as myproject/parts/myproject/go/src/myproject/parts/myproject/go/src/myproject/<ad infinitum>. Possible solutions: 1. Don't recursively symlink 2. Don't blindly build recusively, but rather ask to explicitly state what to build I would very much prefer 2, because otherwise we'll soon see other bugs being reported about people struggling with trying to build a small thing out of a big tree and being unable to because snapcraft blindly builds it all. Been there before in other contexts.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed by hard-linking local sources instead of symlinking them, preventing recursive GOPATH traversal; merged in snapcore/snapcraft#622 (commit a07fa0faa).
stealth/space-bunny-alpha — closed resolved Go plugin infinite recursion when snapcraft.yaml sat inside the project tree, caused by symlinking local sources. Fixed by canonical/snapcraft#622 (commit a07fa0fa), which hard-links (with copy fallback) local sources instead.
stealth/space-bunny-alpha — closed resolved Go plugin infinite recursion from symlinked local sources was fixed by hard-linking local sources instead of symlinking; closing comment cites merged PR #622 (commit a07fa0faa).
stealth/space-bunny-alpha — closed stale Go plugin recursion report was closed without explanation after over a decade of inactivity; no resolving PR or commit was identified.
qwen/qwen3.6-35b-a3b — — Closed without comments, likely abandoned or superseded. Subsequent plugin updates fixed the infinite recursion by avoiding recursive symlinks and enforcing explicit build targets when snapcraft.yaml is in the project tree.
qwen/qwen3.6-35b-a3b — — Closed without resolution, likely abandoned. The Go plugin broke due to infinite recursion when snapcraft.yaml resided in the project tree, causing symlinked source paths to loop during builds. No patch was applied.

Update history

Date Change
created

Related work

  • Likely Fixed By: snapcore/snapcraft#622 (confidence 100%)

    Merged change replacing local-source symlinks with hard links, as confirmed by commit a07fa0faa and the closing comment.

Related issues

Issue Project State Summary Similarity
#1515132 Snapcraft crashes after defining a local source for a golang project snapcraft (launchpad) closed Snapcraft's Go plugin crashed on local source paths because it assumed a URI. Fixed by ubuntu-core/snapcraft#97 (commit f15caeeb1) and confirmed working in 0.5.
74%
#1600428 Setting source: .. causes pull to fail snapcraft (launchpad) closed Fixed by snapcore/snapcraft#725, adding support for snapcraft.yaml in a subdirectory and preventing recursive source copying.
72%
#1644350 Runnig snapcraft with sources on parent folders (over one level) causes infinite loops snapcraft (launchpad) closed Fixed by merged snapcore/snapcraft PR #926: local source traversal now excludes generated Snapcraft directories, preventing recursive copies when building from project subdirectories.
72%
#4285 Snapcraft v7 fails to build core18 snap with local plugins snapcraft closed Snapcraft 7 broke core18 snaps with local plugins (module 'snapcraft' has no attribute 'sources'). Fixed by merged PR #4337 (commit 15011660a) exporting sources to legacy plugins; reporter confirmed success on 7.5.3.
71%
#426 Copy plugin: Follow symlinks if outside of snap. snapcraft merged Merged in canonical/snapcraft#426 (b332715a8), following absolute or out-of-part symlinks to prevent broken links and fix LP #1532515.
71%
#1537728 go plugin: GOROOT env confuses snapcraft go snapcraft (launchpad) closed Resolved in Snapcraft 3.x by isolated build environments that prevent host GOROOT from leaking into Go plugin builds.
70%
#1702661 node plugin fails to capture symlink snapcraft (launchpad) closed Fixed by canonical/snapcraft#1418 (commit b1154631d): the Node.js plugin copied out-of-tree symlink targets during staging, resolving the Heroku CLI packaging failure.
70%