示例#1
0
func (sv SemVer) LessThanMajor(versionB SemVer) bool {
	majorA := semver.Version(sv).Major
	majorB := semver.Version(versionB).Major
	if majorA < majorB {
		return true
	}
	return false
}
示例#2
0
文件: ignition.go 项目: coreos/fuze
func (v *IgnitionVersion) UnmarshalJSON(data []byte) error {
	tv := semver.Version(*v)
	if err := json.Unmarshal(data, &tv); err != nil {
		return err
	}
	*v = IgnitionVersion(tv)
	return nil
}
示例#3
0
func (v *IgnitionVersion) unmarshal(unmarshal func(interface{}) error) error {
	tv := semver.Version(*v)
	if err := unmarshal(&tv); err != nil {
		return err
	}
	*v = IgnitionVersion(tv)
	return nil
}
示例#4
0
文件: ignition.go 项目: coreos/fuze
func (v IgnitionVersion) Validate() report.Report {
	if MaxVersion.Major > v.Major {
		return report.ReportFromError(ErrOldVersion, report.EntryError)
	}
	if MaxVersion.LessThan(semver.Version(v)) {
		return report.ReportFromError(ErrNewVersion, report.EntryError)
	}
	return report.Report{}
}
示例#5
0
func (v IgnitionVersion) AssertValid() error {
	if MaxVersion.Major > v.Major {
		return ErrOldVersion
	}
	if MaxVersion.LessThan(semver.Version(v)) {
		return ErrNewVersion
	}
	return nil
}
示例#6
0
文件: ignition.go 项目: coreos/fuze
func (v IgnitionVersion) MarshalJSON() ([]byte, error) {
	return semver.Version(v).MarshalJSON()
}
示例#7
0
func (sv SemVer) Empty() bool {
	return semver.Version(sv) == semver.Version{}
}
示例#8
0
func (sv SemVer) String() string {
	s := semver.Version(sv)
	return s.String()
}
示例#9
0
func (sv SemVer) LessThanExact(versionB SemVer) bool {
	vA := semver.Version(sv)
	vB := semver.Version(versionB)
	return vA.LessThan(vB)
}