codeowners

package
v0.7.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2026 License: Apache-2.0 Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	LineNo  uint64
	Pattern string
	Owners  []string
}

Entry contains owners for a given pattern

func NewFromPath

func NewFromPath(repoPath string) ([]Entry, error)

NewFromPath returns entries from codeowners

Example
package main

import (
	"fmt"

	"github.com/step-security/codeowners-validator/pkg/codeowners"
)

func main() {
	pathToCodeownersFile := "./testdata/"

	entries, err := codeowners.NewFromPath(pathToCodeownersFile)
	if err != nil {
		panic(err)
	}

	for _, e := range entries {
		fmt.Printf("[line] %d: [pattern]: %s [owners]: %v\n", e.LineNo, e.Pattern, e.Owners)
	}

}
Output:
[line] 8: [pattern]: * [owners]: [@global-owner1 @global-owner2]
[line] 14: [pattern]: *.js [owners]: [@js-owner]
[line] 19: [pattern]: *.go [owners]: [docs@example.com]
[line] 24: [pattern]: /build/logs/ [owners]: [@doctocat]
[line] 29: [pattern]: docs/* [owners]: [docs@example.com]
[line] 33: [pattern]: apps/ [owners]: [@octocat]
[line] 37: [pattern]: /docs/ [owners]: [@doctocat]

func ParseCodeowners

func ParseCodeowners(r io.Reader) []Entry

func (Entry) String

func (e Entry) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL