From 8a5f0b03ea045ae86ce60f63d6492ace10e4ae4c Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Fri, 3 Nov 2023 15:25:00 -0700 Subject: [PATCH] [chore] do not validate that we must have 1 function. If no functions exposed, exit with no error --- cmd/checkapi/allowlist.txt | 1 - cmd/checkapi/main.go | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/checkapi/allowlist.txt b/cmd/checkapi/allowlist.txt index 78f98e2c605b..07f7959a642a 100644 --- a/cmd/checkapi/allowlist.txt +++ b/cmd/checkapi/allowlist.txt @@ -1,5 +1,4 @@ connector/servicegraphconnector -extension/encoding extension/observer processor/servicegraphprocessor receiver/collectdreceiver diff --git a/cmd/checkapi/main.go b/cmd/checkapi/main.go index 609d1fd55991..50d2bff18a71 100644 --- a/cmd/checkapi/main.go +++ b/cmd/checkapi/main.go @@ -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)