Appease linters

This commit is contained in:
Joe Betz
2025-08-28 20:53:54 -04:00
parent e6ae04e02c
commit d85ce5310d
2 changed files with 17 additions and 18 deletions

View File

@@ -391,7 +391,7 @@ func (td *typeDiscoverer) discoverType(t *types.Type, fldPath *field.Path) (*typ
if fldPath.String() != t.String() {
panic(fmt.Sprintf("path for type != the type name: %s, %s", t.String(), fldPath.String()))
}
consts, _ := td.constantsByType[t]
consts := td.constantsByType[t]
context := validators.Context{
Scope: validators.ScopeType,
Type: t,
@@ -1240,25 +1240,25 @@ func emitCallsToValidators(c *generator.Context, validations []validators.Functi
"field": mkSymbolArgs(c, fieldPkgSymbols),
}
emitCall := func() {
sw.Do("$.funcName|raw$", targs)
if typeArgs := v.TypeArgs; len(typeArgs) > 0 {
sw.Do("[", nil)
for i, typeArg := range typeArgs {
sw.Do("$.|raw$", c.Universe.Type(typeArg))
if i < len(typeArgs)-1 {
sw.Do(",", nil)
}
emitCall := func() {
sw.Do("$.funcName|raw$", targs)
if typeArgs := v.TypeArgs; len(typeArgs) > 0 {
sw.Do("[", nil)
for i, typeArg := range typeArgs {
sw.Do("$.|raw$", c.Universe.Type(typeArg))
if i < len(typeArgs)-1 {
sw.Do(",", nil)
}
sw.Do("]", nil)
}
sw.Do("(ctx, op, fldPath, obj, oldObj", targs)
for _, arg := range v.Args {
sw.Do(", ", nil)
toGolangSourceDataLiteral(sw, emitterContext{Context: c}, arg)
}
sw.Do(")", targs)
sw.Do("]", nil)
}
sw.Do("(ctx, op, fldPath, obj, oldObj", targs)
for _, arg := range v.Args {
sw.Do(", ", nil)
toGolangSourceDataLiteral(sw, emitterContext{Context: c}, arg)
}
sw.Do(")", targs)
}
// If validation is conditional, wrap the validation function with a conditions check.
if !v.Conditions.Empty() {

View File

@@ -107,7 +107,6 @@ func (etv *enumTagValidator) GetValidations(context Context, _ codetags.Tag) (Va
switch tag.Name {
case enumExcludeTagName:
isExcluded = true
break
case ifEnabledTag, ifDisabledTag:
if tag.ValueTag != nil && tag.ValueTag.Name == enumExcludeTagName {
if option, ok := tag.PositionalArg(); ok {