Recommended way to package golang app?

I’m thinking of working on packaging an app for yunohost which requires golang to build. (GitHub - ssb-ngi-pointer/go-ssb-room: Room server implemented in Go)

is there a recommended way to do this? something like ynh_install_nodejs but for golang? or should I just install go manually, and then build the app? The tricky part with this would just be detecting the architecture, and downloading the right go file.

Alternatively, I can download pre-built debs of the package, from the release, and install that way. any opinion which is better?

1 Like

In my opinion, binaries should be built upstream … (You could ask upstream if it is possible to make ARM binaries available …)
For Galène app, for exemple, upstream repo doesn’t provide any binary. The binaries are compiled in my computer and pushed to the ynh repo as releases… (Releases · YunoHost-Apps/galene_ynh · GitHub).
Installing GO in the install script to build a binary doesn’t seem like a good solution …
You can start by using the available x86 binary: (https://github.com/ssb-ngi-pointer/go-ssb-room/releases/download/v2.0.6/go-ssb-room_2.0.6_Linux_x86_64.tar.gz).

2 Likes

@ericg thanks for this. makes sense.

I guess the main advantage of building from source on the device, is that its maybe easier to audit the code. As opposed to downloading a deb/binary where you can’t easily see what’s in it and are effectively trusting the upstream, or whoever compiles the binaries (if I’m understanding correctly).