diff --git a/goscan.go b/goscan.go index ad67baab..a0c97dc2 100644 --- a/goscan.go +++ b/goscan.go @@ -98,18 +98,13 @@ func readTable(fileName string) (*gosym.Table, error) { return symTable, nil } -// Checks the .gopclntab for the expected list of symbols. -func ExpectedSyms(expectedSyms []string, symTable *gosym.Table) error { - found := false +// Checks that .gopclntab contains any of the expectedSyms. +func ExpectedSyms(expectedSyms []string, symTable *gosym.Table) bool { for _, s := range expectedSyms { fn := symTable.LookupFunc(s) if fn != nil { - found = true - break + return true } } - if !found { - return fmt.Errorf("expected symbol(s) %v not found", expectedSyms) - } - return nil + return false } diff --git a/validations.go b/validations.go index 5f5f8d17..35fc70bb 100644 --- a/validations.go +++ b/validations.go @@ -94,8 +94,8 @@ func validateGoSymbols(_ context.Context, _ *v1.TagReference, path string, baton return nil } - if err := ExpectedSyms(requiredGolangSymbols, symtable); err != nil { - return fmt.Errorf("go: expected symbols not found for %v: %w", filepath.Base(path), err) + if !ExpectedSyms(requiredGolangSymbols, symtable) { + return fmt.Errorf("go: expected symbols not found for %v", filepath.Base(path)) } return nil }