// ValidateVersion validates a version satisfies required_version.
ValidateVersion validates a version satisfies required_version.
// ValidateVersion validates a version satisfies required_version .
func (c *Config) ValidateVersion(version string) error {
	if c.versionConstraints == nil {
		log.Println("[warn] required_version is empty. Skip checking required_version.")
		return nil
	}
	versionParts := strings.SplitN(version, "-", 2)
	v, err := gv.NewVersion(versionParts[0])
	if err != nil {
		log.Printf("[warn] Invalid version format \"%s\". Skip checking required_version.", version)
		return nil
	}
	if !c.versionConstraints.Check(v) {
		return fmt.Errorf("version %s does not satisfy constraints required_version: %s", version, c.versionConstraints)
	}
	return nil
}
func ( c * Config ) ValidateVersion ( version string ) error { if c . versionConstraints == nil { log . Println ( " " ) return nil } versionParts := strings . SplitN ( version , " " , 2 ) v , err := gv . NewVersion ( versionParts [ 0 ] ) if err != nil { log . Printf ( " \" \" " , version ) return nil } if ! c . versionConstraints . Check ( v ) { return fmt . Errorf ( " " , version , c . versionConstraints ) } return nil }
ValidateVersion validates a version satisfies required_version.
ValidateVersion validates a version satisfies required_version .
// invalid version string (e.g. "current") always allowed