Attempting to create snap for buffalo

I’m trying to contribute a snap package to the buffalo project [1]. This is a bit more complicated that just a plain go app, so I’m hoping someone can assist me a bit.

There are two issues that came up immediately after creating the initial snap.

  1. Buffalo needs golang to be available on the path and because the snap is confined it raises this error: exec: "go": executable file not found in $PATH
    Should I just add go as a part, or is there another way (other than --classic) that I can tell the snap to use the system golang

  2. Buffalo also runs NodeJS in a similar way so the point above regarding golang is also needed for nodejs.

Here is a list of requirements for go buffalo:

My current snapcraft.yml:

name: buffalo # you probably want to 'snapcraft register <name>'
version: 'v0.14.0'
summary: Rapid Web Development w/ Go
description: |
  Buffalo helps you to generate a web project that already has everything from
  front-end to the back-end already hooked up and ready to run. From there it
  provides easy APIs to build your web application quickly in Go.

grade: devel
confinement: devmode

# Buffalo needs access to go and for it to be on the path
# Also needs nodejs to be available.

    source: .
    plugin: go

    # TODO: We probably need this as well
    #   buffalo-pop:
    #     source:
    #     plugin: go
    #     go-importpath:

    command: buffalo

PS: I know some of these issues can be resolved with --classic confinement, but I’d prefer to avoid that if possible.


Correct me if I’m wrong but it seems gobuffalo requires a working go compiler. You would have to bundle it and set environment variables so that it can find the appropriate locations at runtime.

Having that it is easy to have the bundled “go“ on PATH and have it write to SNAP_USER_DATA as appropriate.

Actually I’ve now attempted to do this via --classic as well, but this doesn’t work either. When I run buffalo I just get a empty line doing nothing. and I have to press ctrl-c to stop whatever it’s doing. There is no output or logs that I can see.

How can I debug this?

I’ve changed how I snap this. Since the install instructions is just to download archive and copy the binary within to bin, I opted to just use the dump plugin to install the app, alongside --classic confinement.

This means that the app will still work in the same manner as the manual install instructions, and make use of system installed go runtime, and npm. I think this more in line with the general intention of developers that would be using buffalo.