in tool/resource/ruledef.go [135:157]
func verifyRule(rule *InstBaseRule, checkPath bool) error {
if checkPath {
if rule.Path == "" {
return errc.New(errc.ErrInvalidRule, "local path is empty")
}
}
// Import path should not be empty
if rule.ImportPath == "" {
return errc.New(errc.ErrInvalidRule, "import path is empty")
}
// If version is specified, it should be in the format of [start,end)
for _, v := range []string{rule.Version, rule.GoVersion} {
if v != "" {
if !strings.Contains(v, "[") ||
!strings.Contains(v, ")") ||
!strings.Contains(v, ",") ||
strings.Contains(v, "v") {
return errc.New(errc.ErrInvalidRule, "bad version "+v)
}
}
}
return nil
}