MCPcopy
hub / github.com/cilium/cilium / Load

Function Load

tools/testowners/codeowners/codeowners.go:33–64  ·  view source on GitHub ↗
(paths []string)

Source from the content-addressed store, hash-verified

31}
32
33func Load(paths []string) (*Ruleset, error) {
34 var (
35 allOwners codeowners.Ruleset
36 err error
37 )
38
39 if len(paths) == 0 {
40 allOwners, err = codeowners.LoadFileFromStandardLocation()
41 if err != nil {
42 return nil, fmt.Errorf("while loading: %w", err)
43 }
44 }
45
46 for _, f := range paths {
47 coFile, err := os.Open(f)
48 if err != nil {
49 return nil, fmt.Errorf("while opening %s: %w", f, err)
50 }
51 defer coFile.Close()
52
53 owners, err := codeowners.ParseFile(coFile)
54 if err != nil {
55 return nil, fmt.Errorf("while parsing %s: %w", f, err)
56 }
57
58 allOwners = append(allOwners, owners...)
59 }
60
61 return &Ruleset{
62 Ruleset: allOwners,
63 }, nil
64}
65
66func (r *Ruleset) WithExcludedOwners(excludedOwners []string) *Ruleset {
67 excluded := make(map[string]struct{})

Callers 2

mainFunction · 0.92
SpecDidCompleteMethod · 0.92

Calls 3

OpenMethod · 0.65
CloseMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…