Skip to content

Commit

Permalink
[chore][checkapi] Do not enforce that all packages must have exactly …
Browse files Browse the repository at this point in the history
…one function (open-telemetry#28886)

If no functions are exposed, exit with no error.

This change allows to remove `extension/encoding` from the allowlist.
  • Loading branch information
atoulme authored Nov 17, 2023
1 parent 8372ccc commit c3b2997
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion cmd/checkapi/allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
connector/servicegraphconnector
extension/encoding
extension/observer
processor/servicegraphprocessor
receiver/kafkareceiver
7 changes: 4 additions & 3 deletions cmd/checkapi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,13 @@ func walkFolder(folder string, componentType string) error {
return nil
}

if len(result.Functions) == 0 {
return nil
}
if len(result.Functions) > 1 {
return fmt.Errorf("%s has more than one function: %q", folder, strings.Join(fnNames, ","))
}
if len(result.Functions) == 0 {
return fmt.Errorf("%s has no functions defined", folder)
}

newFactoryFn := result.Functions[0]
if newFactoryFn.Name != "NewFactory" {
return fmt.Errorf("%s does not define a NewFactory function", folder)
Expand Down

0 comments on commit c3b2997

Please sign in to comment.