Update goreleaser config to add the 'v' prefix and remove default values for those variables

This commit is contained in:
Dom Del Nano 2021-03-12 22:04:32 -08:00
parent bcd5c09e65
commit 61fdd0d0d3
2 changed files with 8 additions and 4 deletions

View File

@ -24,7 +24,7 @@ builds:
flags:
- -trimpath #removes all file system paths from the compiled executable
ldflags:
- '-s -w -X main.Version={{.Version}} -X main.VersionPrerelease= '
- '-s -w -X main.Version=v{{.Version}} -X main.VersionPrerelease= '
goos:
- linux
goarch:

10
main.go
View File

@ -13,18 +13,22 @@ import (
var (
// Version is the main version number that is being run at the moment.
Version = "0.3.1"
Version string
// VersionPrerelease is A pre-release marker for the Version. If this is ""
// (empty string) then it means that it is a final release. Otherwise, this
// is a pre-release such as "dev" (in development), "beta", "rc1", etc.
VersionPrerelease = ""
VersionPrerelease string
// PluginVersion is used by the plugin set to allow Packer to recognize
// what version this plugin is.
PluginVersion = version.InitializePluginVersion(Version, VersionPrerelease)
PluginVersion *version.PluginVersion
)
func init() {
PluginVersion = version.InitializePluginVersion(Version, VersionPrerelease)
}
func main() {
pps := plugin.NewSet()
pps.RegisterBuilder("iso", new(iso.Builder))