The Go plugin integrates projects written in Go. This plugin uses the common plugin keywords as well as those for sources. For more information, see Snapcraft parts metadata.
Plugin-specific features and syntax are dependent on which base is being used, as outlined below:
See Go applications for a simple example, or search GitHub for projects already using the plugin.
This is a snapcraft plugin. See Snapcraft plugins and Supported plugins for further details on how plugins are used.
The go
plugin in core22
exclusively requires the use of go.mod.
Additionally, the build environment does not include go
by default. To install the latest version, add go
to a build-snaps section for the part:
build-snaps:
- go
This plugin uses the following plugin-specific keywords:
go-buildtags
(list of strings)
Tags to use during the go build. Default is not to use any build tags.Requires Snapcraft version 7.0+.
The go
plugin in core20
exclusively requires the use of go.mod.
This plugin uses the following plugin-specific keywords:
go-channel
(string, default: latest/stable)
The snap Store channel to install go from. If set to an empty string, go will be installed using the system’s traditional package manager.
go-buildtags
(list of strings)
Tags to use during the go build. Default is not to use any build tags.
Requires Snapcraft version 4.0+.
The go
plugin support in core and core18 can be used by Go projects using go get, the command used to grab a project’s dependencies or go mod
.
This plugin uses the following plugin-specific keywords:
go-channel
(string, default: latest/stable)
The snap Store channel to install go from. If set to an empty string, go will be installed using the system’s traditional package manager.
go-packages
(list of strings)
Go packages to fetch, these must be a “main” package.
Dependencies are pulled in automatically by go get
.
Packages that are not “main” will not cause an error, but would not be useful either.
If the package is a part of the go-importpath the local package
corresponding to those sources will be used
go-importpath
(string)
This entry tells the checked out source
to live within a certain path
within GOPATH
.
This is not needed and does not affect go-packages
.
go-buildtags
(list of strings)
Tags to use during the go build. Default is not to use any build tags.
Requires Snapcraft version 3.x.
Last updated 5 months ago.