mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-20 12:38:08 -04:00
cli: use Semver type to represent microservice versions (#2125)
Previously we used strings to pass microservice versions. This invited bugs due to missing input validation.
This commit is contained in:
parent
2d3999440d
commit
1d5a8283e0
35 changed files with 612 additions and 318 deletions
|
@ -11,7 +11,10 @@ Constants should never be overwritable by command line flags or configuration fi
|
|||
package constants
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/edgelesssys/constellation/v2/internal/semver"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -231,9 +234,15 @@ b92PDCpM7FZAINQF88s1TZS/HmRXYk62UJ4eqPduvUnJmXhNikhLbMi6fw==
|
|||
`
|
||||
)
|
||||
|
||||
// VersionInfo returns the version of a binary.
|
||||
func VersionInfo() string {
|
||||
return versionInfo
|
||||
// BinaryVersion returns the version of this Binary.
|
||||
func BinaryVersion() semver.Semver {
|
||||
version, err := semver.New(versionInfo)
|
||||
if err != nil {
|
||||
// This is not user input, unrecoverable, should never happen.
|
||||
panic(fmt.Sprintf("parsing embedded version information: %s", err))
|
||||
}
|
||||
|
||||
return version
|
||||
}
|
||||
|
||||
// Timestamp returns the commit timestamp of a binary.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue