hashicorp / packer-plugin-sdk

Packer Plugin SDK enables building Packer plugins (builders, provisioners, or post-processors) to manage any service providers or custom in-house solutions
Mozilla Public License 2.0
34 stars 46 forks source link

version: don't remake semVer if not nil #233

Closed lbajolet-hashicorp closed 5 months ago

lbajolet-hashicorp commented 5 months ago

The SemVer function of a PluginVersion returns the version.Version instance bound to the PluginVersion.

In former implementations of the structure, this could be nil in some cases, as only the version components were being registered, and the code would make sure that they were a valid semver version.

Recent changes reorganised this code by making the semVer attribute always present, so while theoretically it could be nil, this would indicate a manipulation error.

Therefore, we don't need to perform this check to re-create the semVer attribute, and by that change we fix the underlying issue that made semVer drop its pre-release/metadata parts when doing so.