Calling Go from a snap

I am trying to create a snap that needs to call go test as it’s a wrapper for that command that prettyfies the output.

So a two-part question.

  1. Can this snap call the go binary installed on the system if it’s not a snap? I’m assuming it’s only yes if my snap is classic.
  2. Can this snap call the go binary installed on the system via snap?

I can’t install Go within the snap because it will likely not be the same version of Go the user is developing with, which can impact the accuracy of running go test for their code.

IMHO, correct.


AFAICT there’s two options:

  • Make the snap classic confinement (NOTE: You must hack the dynamic linker environmental variable before calling any external commands, refer Snap confinement and Subtle differences between devmode and classic confinement snaps )
  • Make several Go runtime as content snaps and instruct users to connect the required Go runtime version to your snap, however in my knowledge such content snap doesn’t exist.

Hmm. Can classic request be done before making the snap? I don’t want to do the work for this if it won’t get approved.

why not? If it’s classic, you can.

1 Like

@FelicianoTech another approach you might consider (keeping in mind I don’t know what it is exactly you’re proposing to package) is talking with @mwhudson to see if he’s interested in including it in the go snap itself.

The tool is

That would cool to get it in the Go snap itself.

Generally speaking I want to keep the Go snap close to the upstream distribution. (I should take another run at getting upstream more interested in maintaining it in fact…)

1 Like