Skip to content

Commit 9378a61

Browse files
authored
Merge pull request #829 from rainest/feat/error-duplicate-gen
✨ Return an error for duplicate generators
2 parents 95ddbaf + 75e6573 commit 9378a61

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/genall/options.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ func protoFromOptions(optionsRegistry *markers.Registry, options []string) (prot
136136
switch val := val.(type) {
137137
case Generator:
138138
gens = append(gens, &val)
139+
if _, alreadyExists := gensByName[defn.Name]; alreadyExists {
140+
return protoRuntime{}, fmt.Errorf("multiple instances of '%s' generator specified", defn.Name)
141+
}
139142
gensByName[defn.Name] = &val
140143
case OutputRule:
141144
_, genName := splitOutputRuleOption(defn.Name)

0 commit comments

Comments
 (0)