Reuse compiled golang

I’d like to use go-sqlite3. Building it takes a long time (~5 mins), and for me this happens on every snapcraft run.

My code has two relevant imports:

import (

    _ ""


The go-sqlite3 import results in rebuilding it every time, but the import is needed to register the sqlite3 driver with database/sql.

Is there a way to add the pre-compiled go binary[1] to my snap so it is not rebuilt every time, but also keep the required go-sqlite3 import?

[1] go/pkg/linux_arm/


1 Like

Yeah, this sounds like something we can have a part for. Independent parts have independent pull/build/install/clean stages.

@sergiusens or @elopio will have more details.

We have not experimented with using go libraries that have been staged for other parts to use, will need to look into the go compiler and get back to this.

1 Like