Skip to content

Commit 919d27b

Browse files
committed
only error on structs with 6 fields or less
1 parent 69086d5 commit 919d27b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cmd/checkapi/main.go

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ import (
2323
"github.com/open-telemetry/opentelemetry-collector-contrib/cmd/checkapi/internal"
2424
)
2525

26+
const (
27+
unkeyedFieldsLimit = 6
28+
)
29+
2630
func main() {
2731
folder := flag.String("folder", ".", "folder investigated for modules")
2832
configPath := flag.String("config", "cmd/checkapi/config.yaml", "configuration file")
@@ -293,6 +297,9 @@ func checkStructDisallowUnkeyedLiteral(s *apistruct, folder string) error {
293297
if !unicode.IsUpper(rune(s.Name[0])) {
294298
return nil
295299
}
300+
if len(s.Fields) > unkeyedFieldsLimit {
301+
return nil
302+
}
296303
for _, f := range s.Fields {
297304
if !unicode.IsUpper(rune(f[0])) {
298305
return nil

0 commit comments

Comments
 (0)