No binaries found from ['go', 'build']


I am using the following simple snapcraft.yaml to snap up a local Go project, the source root of the project is in the same folder as the yaml file. The build seems to succeed and the binary is installed correctly with snap install. However, when the command tries to run the binary on daemon startup, it segfaults immediately. I am unable to debug and am not sure what I am doing wrong. I am specifically curious about why is "no binaries found from [‘go’, ‘build’]"

Here is the cmd output:

snap "core18" has no updates available
Updating pull step for server (source changed)
go mod download
Updating build step for server ('pull' step changed)
go build -o /root/parts/server/install/bin ./...
no binaries found from ['go', 'build']
Cleaning later steps and re-staging server ('build' step changed)
Priming server 
'grade' property not specified: defaulting to 'stable'.
Found unneeded '$SNAP/' in command '$SNAP/bin/main'.
The command '$SNAP/bin/main' has been changed to 'bin/main'.
Snapping |                                                                                                                                                                                              
Snapped server_0.1.0_amd64.snap

Any ideas?

  name: server
    version: 0.1.0
    summary: Cross-Platform Benchmark
    description: Server Service
    confinement: classic
    base: core18

        plugin: go
        source: ./

        command: $SNAP/bin/main
        daemon: simple

I can’t pinpoint the exact reason, but problems related to patchelf come to mind. Does the binary work correctly if you use a different confinement type?

Yes, strict confinement seems to build a better binary. Thank you!!