Snapcraft crashes after defining a local source for a golang project
Metadata
Current evaluation
Closed as fixed. The Go plugin was updated to handle local source paths, resolving the IndexError crash when the source field lacks a protocol.
Suggested action: —
No scores available.
Issue body
I have a simple snappy project at
https://github.com/liu-xiao-guo/go-webserver
If I do not want to use "source: git://github.com/liu-xiao-guo/golang-http" in the snapcraft.yaml to compile the go. Instead, I want to make the source code locally. Then I make the following change to my snapcraft.yaml:
name: go-webserver
vendor: XiaoGuo, Liu <email address hidden>
icon: go.png
version: 1.0.7
summary: Go webserver
description: This is a simple go webserver. It is a service
services:
webserver:
description: "Go websever"
start: bin/golang-http
caps:
- network-client
- network-service
parts:
webserver:
plugin: go
source: ./src/golang-http
Inside the golang-http, it has only one file named "main.go", which can be found at:
https://github.com/liu-xiao-guo/golang-http/blob/master/main.go
liuxg@liuxg:~/snappy/examples/go-webserver1$ snapcraft
Traceback (most recent call last):
File "/usr/bin/snapcraft", line 33, in <module>
snapcraft.main.main()
File "/usr/lib/python3/dist-packages/snapcraft/main.py", line 147, in main
args.func(args)
File "/usr/lib/python3/dist-packages/snapcraft/cmds.py", line 103, in assemble
snap(args)
File "/usr/lib/python3/dist-packages/snapcraft/cmds.py", line 85, in snap
cmd(args)
File "/usr/lib/python3/dist-packages/snapcraft/cmds.py", line 322, in cmd
config = _load_config()
File "/usr/lib/python3/dist-packages/snapcraft/cmds.py", line 387, in _load_config
_config = snapcraft.yaml.Config()
File "/usr/lib/python3/dist-packages/snapcraft/yaml.py", line 139, in __init__
self.load_plugin(part_name, plugin_name, properties)
File "/usr/lib/python3/dist-packages/snapcraft/yaml.py", line 192, in load_plugin
part_name, plugin_name, properties)
File "/usr/lib/python3/dist-packages/snapcraft/lifecycle.py", line 274, in load_plugin
return PluginHandler(plugin_name, part_name, properties)
File "/usr/lib/python3/dist-packages/snapcraft/lifecycle.py", line 65, in __init__
self._load_code(plugin_name, properties)
File "/usr/lib/python3/dist-packages/snapcraft/lifecycle.py", line 92, in _load_code
self.code = plugin(self.name, options)
File "/usr/lib/python3/dist-packages/snapcraft/plugins/go.py", line 56, in __init__
self.fullname = self.options.source.split("://")[1]
IndexError: list index out of range
liuxg@liuxg:~$ snapcraft version
snapcraft (0.4).
Run "snapcraft help" to get started.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Closed as fixed. The Go plugin was updated to handle local source paths, resolving the IndexError crash when the source field lacks a protocol. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed. The Go plugin crash on local source paths was fixed by updating the source parsing logic to handle non-URL strings, preventing the IndexError during configuration loading. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed. The IndexError crash when using local source paths in the Go plugin was fixed in later snapcraft versions after the hardcoded URL parsing logic was updated. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1744686 snapcraft local source is not a directory | snapcraft (launchpad) | closed | Closed without resolution or comments. Premature validation of local source directories blocking inter-plugin dependencies remains unresolved. |