go-codeowners – github.com/hairyhenderson/go-codeowners Index | Examples | Files

package codeowners

import "github.com/hairyhenderson/go-codeowners"

Index

Examples

Types

type Codeowner

type Codeowner struct {
	// contains filtered or unexported fields
}

Codeowner - owners for a given pattern

func NewCodeowner

func NewCodeowner(pattern string, owners []string) (Codeowner, error)

NewCodeowner -

func (Codeowner) String

func (c Codeowner) String() string

type Codeowners

type Codeowners struct {
	// contains filtered or unexported fields
}

Codeowners - patterns/owners mappings for the given repo

func NewCodeowners

func NewCodeowners(path string) (*Codeowners, error)

NewCodeowners -

Example

Code:

{
	c, _ := NewCodeowners(cwd())
	fmt.Println(c.patterns[0])
	// Output:
	// *	@hairyhenderson
}

Output:

*	@hairyhenderson

func (*Codeowners) Owners

func (c *Codeowners) Owners(path string) []string

Owners - return the list of code owners for the given path (within the repo root)

Example

Code:

{
	c, _ := NewCodeowners(cwd())
	owners := c.Owners("README.md")
	for i, o := range owners {
		fmt.Printf("Owner #%d is %s\n", i, o)
	}
	// Output:
	// Owner #0 is @hairyhenderson
}

Output:

Owner #0 is @hairyhenderson

Source Files

codeowners.go

Version
v0.2.2
Published
Feb 21, 2020
Platform
darwin/amd64
Imports
9 packages
Last checked
now

Tools for package owners.