From 410e59f141fb6c0391bbba67d79bdd3631732814 Mon Sep 17 00:00:00 2001 From: Lucas Bajolet Date: Tue, 16 Apr 2024 15:45:53 -0400 Subject: [PATCH] version: compute SemVer from rawVersion A bug in the SDK prevents us from calling SemVer on the PluginVersion derived from the rawVersion, as when doing so, we reset the semVer attribute to only use the core part of the version, thereby dropping any information on pre-release/metadata. This is not ideal, and arguably not wanted. So in order to not lose this information, we re-compute the SemVer from rawVersion, this way we don't overwrite it for both structures. --- version/version.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/version/version.go b/version/version.go index 139025076..edb5a9412 100644 --- a/version/version.go +++ b/version/version.go @@ -54,7 +54,11 @@ func init() { rawVersion = strings.TrimSpace(rawVersion) PackerVersion = pluginVersion.NewRawVersion(rawVersion) - SemVer = PackerVersion.SemVer() + // A bug in the SDK prevents us from calling SemVer on the PluginVersion + // derived from the rawVersion, as when doing so, we reset the semVer + // attribute to only use the core part of the version, thereby dropping any + // information on pre-release/metadata. + SemVer, _ = version.NewVersion(rawVersion) Version = PackerVersion.GetVersion() VersionPrerelease = PackerVersion.GetVersionPrerelease()