mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-28 01:34:19 +00:00
Appease linters
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user