owners

package
v0.0.0-...-e046750 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: BSD-3-Clause Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(w http.ResponseWriter, r *http.Request)

Handler takes one or more paths and returns a map of each to a matching Entry struct. If no Entry is matched for the path, the value for the key is nil.

func TranslatePathForIssues

func TranslatePathForIssues(path string) string

TranslatePathForIssues takes a path for a package based on go.googlesource.com and translates it into a form that aligns more closely with the issue tracker.

Specifically, Go standard library packages lose the go/src prefix, repositories with a golang.org/x/ import path get the x/ prefix, and all other paths are left as-is (this includes e.g. domains).

Types

type Entry

type Entry struct {
	Primary   []Owner `json:"primary"`
	Secondary []Owner `json:"secondary,omitempty"`
}

type Owner

type Owner struct {
	// GitHubUsername is a GitHub user name or team name.
	GitHubUsername string `json:"githubUsername"`
	GerritEmail    string `json:"gerritEmail"`
}

type Request

type Request struct {
	Payload struct {
		// Paths is a set of relative paths rooted at go.googlesource.com,
		// where the first path component refers to the repository name,
		// while the rest refers to a path within that repository.
		//
		// For instance, a path like go/src/runtime/trace/trace.go refers
		// to the repository at go.googlesource.com/go, and the path
		// src/runtime/trace/trace.go within that repository.
		//
		// A request with Paths set will return the owner entry
		// for the deepest part of each path that it has information
		// on.
		//
		// For example, the path go/src/runtime/trace/trace.go will
		// match go/src/runtime/trace if there exist entries for both
		// go/src/runtime and go/src/runtime/trace.
		//
		// Must be empty if All is true.
		Paths []string `json:"paths"`

		// All indicates that the response must contain every available
		// entry about code owners.
		//
		// If All is true, Paths must be empty.
		All bool `json:"all"`
	} `json:"payload"`
	Version int `json:"v"` // API version
}

type Response

type Response struct {
	Payload struct {
		Entries map[string]*Entry `json:"entries"` // paths in request -> Entry
	} `json:"payload"`
	Error string `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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