Skip to content

Commit 3c97b23

Browse files
authored
Merge pull request kubernetes#130795 from thockin/kk_emit_comments_before_validations
Validation-gen: emit comments before validations
2 parents f9e92a1 + 311e589 commit 3c97b23

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pkg/apis/core/v1/zz_generated.validations.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

staging/src/k8s.io/code-generator/cmd/validation-gen/validation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -969,8 +969,8 @@ func (g *genValidations) emitValidationForChild(c *generator.Context, thisChild
969969
panic(fmt.Sprintf("unexpected type-validations on type %v, kind %s", thisNode.valueType, thisNode.valueType.Kind))
970970
}
971971
sw.Do("// type $.inType|raw$\n", targs)
972-
emitCallsToValidators(c, validations.Functions, sw)
973972
emitComments(validations.Comments, sw)
973+
emitCallsToValidators(c, validations.Functions, sw)
974974
sw.Do("\n", nil)
975975
didSome = true
976976
}
@@ -998,8 +998,8 @@ func (g *genValidations) emitValidationForChild(c *generator.Context, thisChild
998998

999999
validations := fld.fieldValidations
10001000
if !validations.Empty() {
1001-
emitCallsToValidators(c, validations.Functions, bufsw)
10021001
emitComments(validations.Comments, bufsw)
1002+
emitCallsToValidators(c, validations.Functions, bufsw)
10031003
}
10041004

10051005
// If the node is nil, this must be a type in a package we are not

0 commit comments

Comments
 (0)