go get github.com/aaronsky/codeowners-coverage/cmd/codeowners-coverage
import (
"fmt"
"github.com/aaronsky/codeowners-coverage"
)
func getMyReport(path string) error {
report, err := coverage.NewCoverageReport(path)
if err != nil {
return err
}
jsonString, err := report.ToFormat(coverage.ReportFormatJSON)
if err != nil {
return err
}
fmt.Println(jsonString)
}
codeowners-coverage
also has a CLI. It works by loading a local Git repository, parsing its CODEOWNERS file, and crawling the disk for matches. To run, simply provide a path to a Git repository.
codeowners-coverage ~/go/src/github.com/docker/compose
In the event of a successful navigation, this will print JSON to stdout describing the coverage attributes of the repository.
This package is licensed under the MIT License.