mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-12-10 21:49:48 -05:00
constants: make VersionInfo readonly (#1316)
The variable VersionInfo is supposed to be set by `go build -X ...` during link time but should not be modified at runtime. This change ensures the underlying var is private and can only be accessed by a public getter.
This commit is contained in:
parent
0157537852
commit
fc33a74c78
24 changed files with 43 additions and 43 deletions
|
|
@ -14,7 +14,6 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/edgelesssys/constellation/v2/internal/constants"
|
||||
"golang.org/x/mod/semver"
|
||||
)
|
||||
|
||||
|
|
@ -93,8 +92,8 @@ func IsValidUpgrade(a, b string) error {
|
|||
}
|
||||
|
||||
// BinaryWith tests that this binarie's version is greater or equal than some target version, but not further away than one minor version.
|
||||
func BinaryWith(target string) error {
|
||||
binaryVersion := EnsurePrefixV(constants.VersionInfo)
|
||||
func BinaryWith(binaryVersion, target string) error {
|
||||
binaryVersion = EnsurePrefixV(binaryVersion)
|
||||
target = EnsurePrefixV(target)
|
||||
if !semver.IsValid(binaryVersion) || !semver.IsValid(target) {
|
||||
return ErrSemVer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue