@@ -28,20 +28,20 @@ const (
2828 CurrentVersion = "0.8.0"
2929
3030 // vCurrent is the current version as a semver-comparable type
31- vCurrent Version = "v" + CurrentVersion
31+ vCurrent version = "v" + CurrentVersion
3232
3333 // These represent the released versions of the CDI specification
34- v010 Version = "v0.1.0"
35- v020 Version = "v0.2.0"
36- v030 Version = "v0.3.0"
37- v040 Version = "v0.4.0"
38- v050 Version = "v0.5.0"
39- v060 Version = "v0.6.0"
40- v070 Version = "v0.7.0"
41- v080 Version = "v0.8.0"
34+ v010 version = "v0.1.0"
35+ v020 version = "v0.2.0"
36+ v030 version = "v0.3.0"
37+ v040 version = "v0.4.0"
38+ v050 version = "v0.5.0"
39+ v060 version = "v0.6.0"
40+ v070 version = "v0.7.0"
41+ v080 version = "v0.8.0"
4242
4343 // vEarliest is the earliest supported version of the CDI specification
44- vEarliest Version = v030
44+ vEarliest version = v030
4545)
4646
4747// validSpecVersions stores a map of spec versions to functions to check the required versions.
@@ -72,44 +72,44 @@ func MinimumRequiredVersion(spec *Spec) (string, error) {
7272 return minVersion .String (), nil
7373}
7474
75- // Version represents a semantic version string
76- type Version string
75+ // version represents a semantic version string
76+ type version string
7777
78- // NewVersion creates a version that can be used for semantic version comparisons.
79- func NewVersion (v string ) Version {
80- return Version ("v" + strings .TrimPrefix (v , "v" ))
78+ // newVersion creates a version that can be used for semantic version comparisons.
79+ func newVersion (v string ) version {
80+ return version ("v" + strings .TrimPrefix (v , "v" ))
8181}
8282
8383// String returns the string representation of the version.
8484// This trims a leading v if present.
85- func (v Version ) String () string {
85+ func (v version ) String () string {
8686 return strings .TrimPrefix (string (v ), "v" )
8787}
8888
8989// IsGreaterThan checks with a version is greater than the specified version.
90- func (v Version ) IsGreaterThan (o Version ) bool {
90+ func (v version ) IsGreaterThan (o version ) bool {
9191 return semver .Compare (string (v ), string (o )) > 0
9292}
9393
9494// IsLatest checks whether the version is the latest supported version
95- func (v Version ) IsLatest () bool {
95+ func (v version ) IsLatest () bool {
9696 return v == vCurrent
9797}
9898
9999type requiredFunc func (* Spec ) bool
100100
101- type requiredVersionMap map [Version ]requiredFunc
101+ type requiredVersionMap map [version ]requiredFunc
102102
103103// isValidVersion checks whether the specified version is valid.
104104// A version is valid if it is contained in the required version map.
105105func (r requiredVersionMap ) isValidVersion (specVersion string ) bool {
106- _ , ok := validSpecVersions [NewVersion (specVersion )]
106+ _ , ok := validSpecVersions [newVersion (specVersion )]
107107
108108 return ok
109109}
110110
111111// requiredVersion returns the minimum version required for the given spec
112- func (r requiredVersionMap ) requiredVersion (spec * Spec ) Version {
112+ func (r requiredVersionMap ) requiredVersion (spec * Spec ) version {
113113 minVersion := vEarliest
114114
115115 for v , isRequired := range validSpecVersions {
0 commit comments