You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
errs=errs.Also(errs, apis.ErrGeneric(fmt.Sprintf("feature flag %s should be set to true to use Enum", config.EnableParamEnum), "").ViaFieldKey("params", p.Name))
157
+
}
158
+
ifp.Type!=ParamTypeString {
159
+
errs=errs.Also(apis.ErrGeneric("enum can only be set with string type param", "").ViaFieldKey("params", p.Name))
160
+
}
161
+
fordup:=rangefindDups(p.Enum) {
162
+
errs=errs.Also(apis.ErrGeneric(fmt.Sprintf("parameter enum value %v appears more than once", dup), "").ViaFieldKey("params", p.Name))
142
163
}
143
-
seen.Insert(n)
144
-
}
145
-
forn:=rangedups {
146
-
errs=errs.Also(apis.ErrGeneric("parameter appears more than once", "").ViaFieldKey("params", n))
147
164
}
148
165
returnerrs
149
166
}
150
167
168
+
// findDups returns the duplicate element in the given slice
169
+
funcfindDups(vals []string) sets.String {
170
+
seen:= sets.String{}
171
+
dups:= sets.String{}
172
+
for_, val:=rangevals {
173
+
ifseen.Has(val) {
174
+
dups.Insert(val)
175
+
}
176
+
seen.Insert(val)
177
+
}
178
+
returndups
179
+
}
180
+
151
181
// Param declares an ParamValues to use for the parameter called name.
0 commit comments