Skip to content

Commit

Permalink
Return an error for duplicate generators
Browse files Browse the repository at this point in the history
Return an error from controller-gen if the command includes multiple
instances of the same generator.
  • Loading branch information
rainest authored and k8s-infra-cherrypick-robot committed Jul 13, 2023
1 parent 20b9845 commit 35f6df7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/genall/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ func protoFromOptions(optionsRegistry *markers.Registry, options []string) (prot
switch val := val.(type) {
case Generator:
gens = append(gens, &val)
if _, alreadyExists := gensByName[defn.Name]; alreadyExists {
return protoRuntime{}, fmt.Errorf("multiple instances of '%s' generator specified", defn.Name)
}
gensByName[defn.Name] = &val
case OutputRule:
_, genName := splitOutputRuleOption(defn.Name)
Expand Down

0 comments on commit 35f6df7

Please sign in to comment.