Hi,
I’m building a snap with multiple parts where I want to use different golang versions for different parts. So a snapcraft.yaml for testing looks like:
---
name: test-build-snaps
summary: Test build snaps
description: |
Test build snaps
version: git
base: core22
confinement: strict
contact: thomas.bechtold@canonical.com
apps:
app1:
command: bin/app1
app2:
command: bin/app2
parts:
app1:
plugin: dump
source: .
build-snaps:
- go/1.23/stable
override-build: |
mkdir -p bin
echo "#!/bin/bash -eux" > bin/app1
echo "echo \"$(go version)\"" >> bin/app1
chmod 555 bin/app1
craftctl default
app2:
plugin: dump
source: .
build-snaps:
- go/1.22/stable
override-build: |
mkdir -p bin
echo "#!/bin/bash -eux" > bin/app2
echo "echo \"$(go version)\"" >> bin/app2
chmod 555 bin/app2
craftctl default
app1
should use go/1.23/stable
and app2
should use go/1.22/stable
.
But building that snap and checking the content of bin/app1
and bin/app2
gives:
$ cat /snap/test-build-snaps/current/bin/app1
#!/bin/bash -eux
echo "go version go1.22.11 linux/amd64"
$ cat /snap/test-build-snaps/current/bin/app2
#!/bin/bash -eux
echo "go version go1.22.11 linux/amd64"
This is unexpected and leads to problems if one part requires a specific golang version and another part requires a different version.