buildgolang.org/x/build/devapp/owners Index | Files

package owners

import "golang.org/x/build/devapp/owners"

Index

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"`

		// Platform indicates that the response should contain all platform
		// owners entries.
		Platform bool `json:"platform"`
	} `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
		Platforms map[string]*Entry `json:"platforms"` // platforms (GOOS or GOARCH) -> Entry
	} `json:"payload"`
	Error string `json:"error,omitempty"`
}

Source Files

owners.go table.go

Version
v0.0.0-20250421191922-3619c213cff3 (latest)
Published
Apr 21, 2025
Platform
linux/amd64
Imports
10 packages
Last checked
2 months ago

Tools for package owners.