hack/update-vendor.sh

This commit is contained in:
Jordan Liggitt
2019-11-05 14:11:10 -05:00
parent 9a5b7c24ad
commit 297570e06a
932 changed files with 77190 additions and 28219 deletions

View File

@@ -1,943 +0,0 @@
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
/*
mksyscall_windows generates windows system call bodies
It parses all files specified on command line containing function
prototypes (like syscall_windows.go) and prints system call bodies
to standard output.
The prototypes are marked by lines beginning with "//sys" and read
like func declarations if //sys is replaced by func, but:
* The parameter lists must give a name for each argument. This
includes return parameters.
* The parameter lists must give a type for each argument:
the (x, y, z int) shorthand is not allowed.
* If the return parameter is an error number, it must be named err.
* If go func name needs to be different from it's winapi dll name,
the winapi name could be specified at the end, after "=" sign, like
//sys LoadLibrary(libname string) (handle uint32, err error) = LoadLibraryA
* Each function that returns err needs to supply a condition, that
return value of winapi will be tested against to detect failure.
This would set err to windows "last-error", otherwise it will be nil.
The value can be provided at end of //sys declaration, like
//sys LoadLibrary(libname string) (handle uint32, err error) [failretval==-1] = LoadLibraryA
and is [failretval==0] by default.
Usage:
mksyscall_windows [flags] [path ...]
The flags are:
-output
Specify output file name (outputs to console if blank).
-trace
Generate print statement after every syscall.
*/
package main
import (
"bufio"
"bytes"
"errors"
"flag"
"fmt"
"go/format"
"go/parser"
"go/token"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
"runtime"
"sort"
"strconv"
"strings"
"text/template"
)
var (
filename = flag.String("output", "", "output file name (standard output if omitted)")
printTraceFlag = flag.Bool("trace", false, "generate print statement after every syscall")
systemDLL = flag.Bool("systemdll", true, "whether all DLLs should be loaded from the Windows system directory")
winio = flag.Bool("winio", false, "import go-winio")
)
func trim(s string) string {
return strings.Trim(s, " \t")
}
var packageName string
func packagename() string {
return packageName
}
func syscalldot() string {
if packageName == "syscall" {
return ""
}
return "syscall."
}
// Param is function parameter
type Param struct {
Name string
Type string
fn *Fn
tmpVarIdx int
}
// tmpVar returns temp variable name that will be used to represent p during syscall.
func (p *Param) tmpVar() string {
if p.tmpVarIdx < 0 {
p.tmpVarIdx = p.fn.curTmpVarIdx
p.fn.curTmpVarIdx++
}
return fmt.Sprintf("_p%d", p.tmpVarIdx)
}
// BoolTmpVarCode returns source code for bool temp variable.
func (p *Param) BoolTmpVarCode() string {
const code = `var %s uint32
if %s {
%s = 1
} else {
%s = 0
}`
tmp := p.tmpVar()
return fmt.Sprintf(code, tmp, p.Name, tmp, tmp)
}
// SliceTmpVarCode returns source code for slice temp variable.
func (p *Param) SliceTmpVarCode() string {
const code = `var %s *%s
if len(%s) > 0 {
%s = &%s[0]
}`
tmp := p.tmpVar()
return fmt.Sprintf(code, tmp, p.Type[2:], p.Name, tmp, p.Name)
}
// StringTmpVarCode returns source code for string temp variable.
func (p *Param) StringTmpVarCode() string {
errvar := p.fn.Rets.ErrorVarName()
if errvar == "" {
errvar = "_"
}
tmp := p.tmpVar()
const code = `var %s %s
%s, %s = %s(%s)`
s := fmt.Sprintf(code, tmp, p.fn.StrconvType(), tmp, errvar, p.fn.StrconvFunc(), p.Name)
if errvar == "-" {
return s
}
const morecode = `
if %s != nil {
return
}`
return s + fmt.Sprintf(morecode, errvar)
}
// TmpVarCode returns source code for temp variable.
func (p *Param) TmpVarCode() string {
switch {
case p.Type == "bool":
return p.BoolTmpVarCode()
case strings.HasPrefix(p.Type, "[]"):
return p.SliceTmpVarCode()
default:
return ""
}
}
// TmpVarHelperCode returns source code for helper's temp variable.
func (p *Param) TmpVarHelperCode() string {
if p.Type != "string" {
return ""
}
return p.StringTmpVarCode()
}
// SyscallArgList returns source code fragments representing p parameter
// in syscall. Slices are translated into 2 syscall parameters: pointer to
// the first element and length.
func (p *Param) SyscallArgList() []string {
t := p.HelperType()
var s string
switch {
case t[0] == '*':
s = fmt.Sprintf("unsafe.Pointer(%s)", p.Name)
case t == "bool":
s = p.tmpVar()
case strings.HasPrefix(t, "[]"):
return []string{
fmt.Sprintf("uintptr(unsafe.Pointer(%s))", p.tmpVar()),
fmt.Sprintf("uintptr(len(%s))", p.Name),
}
default:
s = p.Name
}
return []string{fmt.Sprintf("uintptr(%s)", s)}
}
// IsError determines if p parameter is used to return error.
func (p *Param) IsError() bool {
return p.Name == "err" && p.Type == "error"
}
// HelperType returns type of parameter p used in helper function.
func (p *Param) HelperType() string {
if p.Type == "string" {
return p.fn.StrconvType()
}
return p.Type
}
// join concatenates parameters ps into a string with sep separator.
// Each parameter is converted into string by applying fn to it
// before conversion.
func join(ps []*Param, fn func(*Param) string, sep string) string {
if len(ps) == 0 {
return ""
}
a := make([]string, 0)
for _, p := range ps {
a = append(a, fn(p))
}
return strings.Join(a, sep)
}
// Rets describes function return parameters.
type Rets struct {
Name string
Type string
ReturnsError bool
FailCond string
}
// ErrorVarName returns error variable name for r.
func (r *Rets) ErrorVarName() string {
if r.ReturnsError {
return "err"
}
if r.Type == "error" {
return r.Name
}
return ""
}
// ToParams converts r into slice of *Param.
func (r *Rets) ToParams() []*Param {
ps := make([]*Param, 0)
if len(r.Name) > 0 {
ps = append(ps, &Param{Name: r.Name, Type: r.Type})
}
if r.ReturnsError {
ps = append(ps, &Param{Name: "err", Type: "error"})
}
return ps
}
// List returns source code of syscall return parameters.
func (r *Rets) List() string {
s := join(r.ToParams(), func(p *Param) string { return p.Name + " " + p.Type }, ", ")
if len(s) > 0 {
s = "(" + s + ")"
}
return s
}
// PrintList returns source code of trace printing part correspondent
// to syscall return values.
func (r *Rets) PrintList() string {
return join(r.ToParams(), func(p *Param) string { return fmt.Sprintf(`"%s=", %s, `, p.Name, p.Name) }, `", ", `)
}
// SetReturnValuesCode returns source code that accepts syscall return values.
func (r *Rets) SetReturnValuesCode() string {
if r.Name == "" && !r.ReturnsError {
return ""
}
retvar := "r0"
if r.Name == "" {
retvar = "r1"
}
errvar := "_"
if r.ReturnsError {
errvar = "e1"
}
return fmt.Sprintf("%s, _, %s := ", retvar, errvar)
}
func (r *Rets) useLongHandleErrorCode(retvar string) string {
const code = `if %s {
if e1 != 0 {
err = errnoErr(e1)
} else {
err = %sEINVAL
}
}`
cond := retvar + " == 0"
if r.FailCond != "" {
cond = strings.Replace(r.FailCond, "failretval", retvar, 1)
}
return fmt.Sprintf(code, cond, syscalldot())
}
// SetErrorCode returns source code that sets return parameters.
func (r *Rets) SetErrorCode() string {
const code = `if r0 != 0 {
%s = %sErrno(r0)
}`
const hrCode = `if int32(r0) < 0 {
if r0&0x1fff0000 == 0x00070000 {
r0 &= 0xffff
}
%s = %sErrno(r0)
}`
if r.Name == "" && !r.ReturnsError {
return ""
}
if r.Name == "" {
return r.useLongHandleErrorCode("r1")
}
if r.Type == "error" {
if r.Name == "hr" {
return fmt.Sprintf(hrCode, r.Name, syscalldot())
} else {
return fmt.Sprintf(code, r.Name, syscalldot())
}
}
s := ""
switch {
case r.Type[0] == '*':
s = fmt.Sprintf("%s = (%s)(unsafe.Pointer(r0))", r.Name, r.Type)
case r.Type == "bool":
s = fmt.Sprintf("%s = r0 != 0", r.Name)
default:
s = fmt.Sprintf("%s = %s(r0)", r.Name, r.Type)
}
if !r.ReturnsError {
return s
}
return s + "\n\t" + r.useLongHandleErrorCode(r.Name)
}
// Fn describes syscall function.
type Fn struct {
Name string
Params []*Param
Rets *Rets
PrintTrace bool
confirmproc bool
dllname string
dllfuncname string
src string
// TODO: get rid of this field and just use parameter index instead
curTmpVarIdx int // insure tmp variables have uniq names
}
// extractParams parses s to extract function parameters.
func extractParams(s string, f *Fn) ([]*Param, error) {
s = trim(s)
if s == "" {
return nil, nil
}
a := strings.Split(s, ",")
ps := make([]*Param, len(a))
for i := range ps {
s2 := trim(a[i])
b := strings.Split(s2, " ")
if len(b) != 2 {
b = strings.Split(s2, "\t")
if len(b) != 2 {
return nil, errors.New("Could not extract function parameter from \"" + s2 + "\"")
}
}
ps[i] = &Param{
Name: trim(b[0]),
Type: trim(b[1]),
fn: f,
tmpVarIdx: -1,
}
}
return ps, nil
}
// extractSection extracts text out of string s starting after start
// and ending just before end. found return value will indicate success,
// and prefix, body and suffix will contain correspondent parts of string s.
func extractSection(s string, start, end rune) (prefix, body, suffix string, found bool) {
s = trim(s)
if strings.HasPrefix(s, string(start)) {
// no prefix
body = s[1:]
} else {
a := strings.SplitN(s, string(start), 2)
if len(a) != 2 {
return "", "", s, false
}
prefix = a[0]
body = a[1]
}
a := strings.SplitN(body, string(end), 2)
if len(a) != 2 {
return "", "", "", false
}
return prefix, a[0], a[1], true
}
// newFn parses string s and return created function Fn.
func newFn(s string) (*Fn, error) {
s = trim(s)
f := &Fn{
Rets: &Rets{},
src: s,
PrintTrace: *printTraceFlag,
}
// function name and args
prefix, body, s, found := extractSection(s, '(', ')')
if !found || prefix == "" {
return nil, errors.New("Could not extract function name and parameters from \"" + f.src + "\"")
}
f.Name = prefix
var err error
f.Params, err = extractParams(body, f)
if err != nil {
return nil, err
}
// return values
_, body, s, found = extractSection(s, '(', ')')
if found {
r, err := extractParams(body, f)
if err != nil {
return nil, err
}
switch len(r) {
case 0:
case 1:
if r[0].IsError() {
f.Rets.ReturnsError = true
} else {
f.Rets.Name = r[0].Name
f.Rets.Type = r[0].Type
}
case 2:
if !r[1].IsError() {
return nil, errors.New("Only last windows error is allowed as second return value in \"" + f.src + "\"")
}
f.Rets.ReturnsError = true
f.Rets.Name = r[0].Name
f.Rets.Type = r[0].Type
default:
return nil, errors.New("Too many return values in \"" + f.src + "\"")
}
}
// fail condition
_, body, s, found = extractSection(s, '[', ']')
if found {
f.Rets.FailCond = body
}
// dll and dll function names
s = trim(s)
if s == "" {
return f, nil
}
if !strings.HasPrefix(s, "=") {
return nil, errors.New("Could not extract dll name from \"" + f.src + "\"")
}
s = trim(s[1:])
a := strings.Split(s, ".")
switch len(a) {
case 1:
f.dllfuncname = a[0]
case 2:
f.dllname = a[0]
f.dllfuncname = a[1]
default:
return nil, errors.New("Could not extract dll name from \"" + f.src + "\"")
}
if f.dllfuncname[len(f.dllfuncname)-1] == '?' {
f.confirmproc = true
f.dllfuncname = f.dllfuncname[0 : len(f.dllfuncname)-1]
}
return f, nil
}
// DLLName returns DLL name for function f.
func (f *Fn) DLLName() string {
if f.dllname == "" {
return "kernel32"
}
return f.dllname
}
// DLLName returns DLL function name for function f.
func (f *Fn) DLLFuncName() string {
if f.dllfuncname == "" {
return f.Name
}
return f.dllfuncname
}
func (f *Fn) ConfirmProc() bool {
return f.confirmproc
}
// ParamList returns source code for function f parameters.
func (f *Fn) ParamList() string {
return join(f.Params, func(p *Param) string { return p.Name + " " + p.Type }, ", ")
}
// HelperParamList returns source code for helper function f parameters.
func (f *Fn) HelperParamList() string {
return join(f.Params, func(p *Param) string { return p.Name + " " + p.HelperType() }, ", ")
}
// ParamPrintList returns source code of trace printing part correspondent
// to syscall input parameters.
func (f *Fn) ParamPrintList() string {
return join(f.Params, func(p *Param) string { return fmt.Sprintf(`"%s=", %s, `, p.Name, p.Name) }, `", ", `)
}
// ParamCount return number of syscall parameters for function f.
func (f *Fn) ParamCount() int {
n := 0
for _, p := range f.Params {
n += len(p.SyscallArgList())
}
return n
}
// SyscallParamCount determines which version of Syscall/Syscall6/Syscall9/...
// to use. It returns parameter count for correspondent SyscallX function.
func (f *Fn) SyscallParamCount() int {
n := f.ParamCount()
switch {
case n <= 3:
return 3
case n <= 6:
return 6
case n <= 9:
return 9
case n <= 12:
return 12
case n <= 15:
return 15
default:
panic("too many arguments to system call")
}
}
// Syscall determines which SyscallX function to use for function f.
func (f *Fn) Syscall() string {
c := f.SyscallParamCount()
if c == 3 {
return syscalldot() + "Syscall"
}
return syscalldot() + "Syscall" + strconv.Itoa(c)
}
// SyscallParamList returns source code for SyscallX parameters for function f.
func (f *Fn) SyscallParamList() string {
a := make([]string, 0)
for _, p := range f.Params {
a = append(a, p.SyscallArgList()...)
}
for len(a) < f.SyscallParamCount() {
a = append(a, "0")
}
return strings.Join(a, ", ")
}
// HelperCallParamList returns source code of call into function f helper.
func (f *Fn) HelperCallParamList() string {
a := make([]string, 0, len(f.Params))
for _, p := range f.Params {
s := p.Name
if p.Type == "string" {
s = p.tmpVar()
}
a = append(a, s)
}
return strings.Join(a, ", ")
}
// IsUTF16 is true, if f is W (utf16) function. It is false
// for all A (ascii) functions.
func (_ *Fn) IsUTF16() bool {
return true
}
// StrconvFunc returns name of Go string to OS string function for f.
func (f *Fn) StrconvFunc() string {
if f.IsUTF16() {
return syscalldot() + "UTF16PtrFromString"
}
return syscalldot() + "BytePtrFromString"
}
// StrconvType returns Go type name used for OS string for f.
func (f *Fn) StrconvType() string {
if f.IsUTF16() {
return "*uint16"
}
return "*byte"
}
// HasStringParam is true, if f has at least one string parameter.
// Otherwise it is false.
func (f *Fn) HasStringParam() bool {
for _, p := range f.Params {
if p.Type == "string" {
return true
}
}
return false
}
var uniqDllFuncName = make(map[string]bool)
// IsNotDuplicate is true if f is not a duplicated function
func (f *Fn) IsNotDuplicate() bool {
funcName := f.DLLFuncName()
if uniqDllFuncName[funcName] == false {
uniqDllFuncName[funcName] = true
return true
}
return false
}
// HelperName returns name of function f helper.
func (f *Fn) HelperName() string {
if !f.HasStringParam() {
return f.Name
}
return "_" + f.Name
}
// Source files and functions.
type Source struct {
Funcs []*Fn
Files []string
StdLibImports []string
ExternalImports []string
}
func (src *Source) Import(pkg string) {
src.StdLibImports = append(src.StdLibImports, pkg)
sort.Strings(src.StdLibImports)
}
func (src *Source) ExternalImport(pkg string) {
src.ExternalImports = append(src.ExternalImports, pkg)
sort.Strings(src.ExternalImports)
}
// ParseFiles parses files listed in fs and extracts all syscall
// functions listed in sys comments. It returns source files
// and functions collection *Source if successful.
func ParseFiles(fs []string) (*Source, error) {
src := &Source{
Funcs: make([]*Fn, 0),
Files: make([]string, 0),
StdLibImports: []string{
"unsafe",
},
ExternalImports: make([]string, 0),
}
for _, file := range fs {
if err := src.ParseFile(file); err != nil {
return nil, err
}
}
return src, nil
}
// DLLs return dll names for a source set src.
func (src *Source) DLLs() []string {
uniq := make(map[string]bool)
r := make([]string, 0)
for _, f := range src.Funcs {
name := f.DLLName()
if _, found := uniq[name]; !found {
uniq[name] = true
r = append(r, name)
}
}
return r
}
// ParseFile adds additional file path to a source set src.
func (src *Source) ParseFile(path string) error {
file, err := os.Open(path)
if err != nil {
return err
}
defer file.Close()
s := bufio.NewScanner(file)
for s.Scan() {
t := trim(s.Text())
if len(t) < 7 {
continue
}
if !strings.HasPrefix(t, "//sys") {
continue
}
t = t[5:]
if !(t[0] == ' ' || t[0] == '\t') {
continue
}
f, err := newFn(t[1:])
if err != nil {
return err
}
src.Funcs = append(src.Funcs, f)
}
if err := s.Err(); err != nil {
return err
}
src.Files = append(src.Files, path)
// get package name
fset := token.NewFileSet()
_, err = file.Seek(0, 0)
if err != nil {
return err
}
pkg, err := parser.ParseFile(fset, "", file, parser.PackageClauseOnly)
if err != nil {
return err
}
packageName = pkg.Name.Name
return nil
}
// IsStdRepo returns true if src is part of standard library.
func (src *Source) IsStdRepo() (bool, error) {
if len(src.Files) == 0 {
return false, errors.New("no input files provided")
}
abspath, err := filepath.Abs(src.Files[0])
if err != nil {
return false, err
}
goroot := runtime.GOROOT()
if runtime.GOOS == "windows" {
abspath = strings.ToLower(abspath)
goroot = strings.ToLower(goroot)
}
sep := string(os.PathSeparator)
if !strings.HasSuffix(goroot, sep) {
goroot += sep
}
return strings.HasPrefix(abspath, goroot), nil
}
// Generate output source file from a source set src.
func (src *Source) Generate(w io.Writer) error {
const (
pkgStd = iota // any package in std library
pkgXSysWindows // x/sys/windows package
pkgOther
)
isStdRepo, err := src.IsStdRepo()
if err != nil {
return err
}
var pkgtype int
switch {
case isStdRepo:
pkgtype = pkgStd
case packageName == "windows":
// TODO: this needs better logic than just using package name
pkgtype = pkgXSysWindows
default:
pkgtype = pkgOther
}
if *systemDLL {
switch pkgtype {
case pkgStd:
src.Import("internal/syscall/windows/sysdll")
case pkgXSysWindows:
default:
src.ExternalImport("golang.org/x/sys/windows")
}
}
if *winio {
src.ExternalImport("github.com/Microsoft/go-winio")
}
if packageName != "syscall" {
src.Import("syscall")
}
funcMap := template.FuncMap{
"packagename": packagename,
"syscalldot": syscalldot,
"newlazydll": func(dll string) string {
arg := "\"" + dll + ".dll\""
if !*systemDLL {
return syscalldot() + "NewLazyDLL(" + arg + ")"
}
if strings.HasPrefix(dll, "api_") || strings.HasPrefix(dll, "ext_") {
arg = strings.Replace(arg, "_", "-", -1)
}
switch pkgtype {
case pkgStd:
return syscalldot() + "NewLazyDLL(sysdll.Add(" + arg + "))"
case pkgXSysWindows:
return "NewLazySystemDLL(" + arg + ")"
default:
return "windows.NewLazySystemDLL(" + arg + ")"
}
},
}
t := template.Must(template.New("main").Funcs(funcMap).Parse(srcTemplate))
err = t.Execute(w, src)
if err != nil {
return errors.New("Failed to execute template: " + err.Error())
}
return nil
}
func usage() {
fmt.Fprintf(os.Stderr, "usage: mksyscall_windows [flags] [path ...]\n")
flag.PrintDefaults()
os.Exit(1)
}
func main() {
flag.Usage = usage
flag.Parse()
if len(flag.Args()) <= 0 {
fmt.Fprintf(os.Stderr, "no files to parse provided\n")
usage()
}
src, err := ParseFiles(flag.Args())
if err != nil {
log.Fatal(err)
}
var buf bytes.Buffer
if err := src.Generate(&buf); err != nil {
log.Fatal(err)
}
data, err := format.Source(buf.Bytes())
if err != nil {
log.Fatal(err)
}
if *filename == "" {
_, err = os.Stdout.Write(data)
} else {
err = ioutil.WriteFile(*filename, data, 0644)
}
if err != nil {
log.Fatal(err)
}
}
// TODO: use println instead to print in the following template
const srcTemplate = `
{{define "main"}}// Code generated mksyscall_windows.exe DO NOT EDIT
package {{packagename}}
import (
{{range .StdLibImports}}"{{.}}"
{{end}}
{{range .ExternalImports}}"{{.}}"
{{end}}
)
var _ unsafe.Pointer
// Do the interface allocations only once for common
// Errno values.
const (
errnoERROR_IO_PENDING = 997
)
var (
errERROR_IO_PENDING error = {{syscalldot}}Errno(errnoERROR_IO_PENDING)
)
// errnoErr returns common boxed Errno values, to prevent
// allocations at runtime.
func errnoErr(e {{syscalldot}}Errno) error {
switch e {
case 0:
return nil
case errnoERROR_IO_PENDING:
return errERROR_IO_PENDING
}
// TODO: add more here, after collecting data on the common
// error values see on Windows. (perhaps when running
// all.bat?)
return e
}
var (
{{template "dlls" .}}
{{template "funcnames" .}})
{{range .Funcs}}{{if .HasStringParam}}{{template "helperbody" .}}{{end}}{{template "funcbody" .}}{{end}}
{{end}}
{{/* help functions */}}
{{define "dlls"}}{{range .DLLs}} mod{{.}} = {{newlazydll .}}
{{end}}{{end}}
{{define "funcnames"}}{{range .Funcs}}{{if .IsNotDuplicate}} proc{{.DLLFuncName}} = mod{{.DLLName}}.NewProc("{{.DLLFuncName}}"){{end}}
{{end}}{{end}}
{{define "helperbody"}}
func {{.Name}}({{.ParamList}}) {{template "results" .}}{
{{template "helpertmpvars" .}} return {{.HelperName}}({{.HelperCallParamList}})
}
{{end}}
{{define "funcbody"}}
func {{.HelperName}}({{.HelperParamList}}) {{template "results" .}}{
{{template "tmpvars" .}} {{template "syscallcheck" .}}{{template "syscall" .}}
{{template "seterror" .}}{{template "printtrace" .}} return
}
{{end}}
{{define "helpertmpvars"}}{{range .Params}}{{if .TmpVarHelperCode}} {{.TmpVarHelperCode}}
{{end}}{{end}}{{end}}
{{define "tmpvars"}}{{range .Params}}{{if .TmpVarCode}} {{.TmpVarCode}}
{{end}}{{end}}{{end}}
{{define "results"}}{{if .Rets.List}}{{.Rets.List}} {{end}}{{end}}
{{define "syscall"}}{{.Rets.SetReturnValuesCode}}{{.Syscall}}(proc{{.DLLFuncName}}.Addr(), {{.ParamCount}}, {{.SyscallParamList}}){{end}}
{{define "syscallcheck"}}{{if .ConfirmProc}}if {{.Rets.ErrorVarName}} = proc{{.DLLFuncName}}.Find(); {{.Rets.ErrorVarName}} != nil {
return
}
{{end}}{{end}}
{{define "seterror"}}{{if .Rets.SetErrorCode}} {{.Rets.SetErrorCode}}
{{end}}{{end}}
{{define "printtrace"}}{{if .PrintTrace}} print("SYSCALL: {{.Name}}(", {{.ParamPrintList}}") (", {{.Rets.PrintList}}")\n")
{{end}}{{end}}
`

View File

@@ -8,6 +8,7 @@ go_library(
"fix-update.go",
"gazelle.go",
"langs.go",
"metaresolver.go",
"print.go",
"update-repos.go",
"version.go",
@@ -16,18 +17,18 @@ go_library(
importpath = "github.com/bazelbuild/bazel-gazelle/cmd/gazelle",
visibility = ["//visibility:private"],
deps = [
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/config:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/flag:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/label:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/language:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/language/go:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/language/proto:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/merger:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/repos:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/resolve:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/rule:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/config:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/flag:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/version:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/walk:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/label:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/language:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/language/go:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/language/proto:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/merger:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/repo:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/resolve:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/rule:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/walk:go_default_library",
"//vendor/github.com/pmezard/go-difflib/difflib:go_default_library",
],
)

View File

@@ -22,11 +22,13 @@ import (
"os"
"path/filepath"
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/rule"
"github.com/pmezard/go-difflib/difflib"
)
var exitError = fmt.Errorf("encountered changes while running diff")
func diffFile(c *config.Config, f *rule.File) error {
rel, err := filepath.Rel(c.RepoRoot, f.Path)
if err != nil {
@@ -79,5 +81,9 @@ func diffFile(c *config.Config, f *rule.File) error {
if err := difflib.WriteUnifiedDiff(out, diff); err != nil {
return fmt.Errorf("error diffing %s: %v", f.Path, err)
}
if ds, _ := difflib.GetUnifiedDiffString(diff); ds != "" {
return exitError
}
return nil
}

View File

@@ -23,29 +23,31 @@ import (
"log"
"os"
"path/filepath"
"sort"
"strings"
"github.com/bazelbuild/bazel-gazelle/internal/config"
gzflag "github.com/bazelbuild/bazel-gazelle/internal/flag"
"github.com/bazelbuild/bazel-gazelle/internal/label"
"github.com/bazelbuild/bazel-gazelle/internal/merger"
"github.com/bazelbuild/bazel-gazelle/internal/repos"
"github.com/bazelbuild/bazel-gazelle/internal/resolve"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/internal/walk"
"github.com/bazelbuild/bazel-gazelle/config"
gzflag "github.com/bazelbuild/bazel-gazelle/flag"
"github.com/bazelbuild/bazel-gazelle/label"
"github.com/bazelbuild/bazel-gazelle/language"
"github.com/bazelbuild/bazel-gazelle/merger"
"github.com/bazelbuild/bazel-gazelle/repo"
"github.com/bazelbuild/bazel-gazelle/resolve"
"github.com/bazelbuild/bazel-gazelle/rule"
"github.com/bazelbuild/bazel-gazelle/walk"
)
// updateConfig holds configuration information needed to run the fix and
// update commands. This includes everything in config.Config, but it also
// includes some additional fields that aren't relevant to other packages.
type updateConfig struct {
dirs []string
emit emitFunc
repos []repos.Repo
useIndex bool
walkMode walk.Mode
patchPath string
patchBuffer bytes.Buffer
dirs []string
emit emitFunc
repos []repo.Repo
workspaceFiles []*rule.File
walkMode walk.Mode
patchPath string
patchBuffer bytes.Buffer
}
type emitFunc func(c *config.Config, f *rule.File) error
@@ -63,8 +65,10 @@ func getUpdateConfig(c *config.Config) *updateConfig {
}
type updateConfigurer struct {
mode string
recursive bool
mode string
recursive bool
knownImports []string
repoConfigPath string
}
func (ucr *updateConfigurer) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config) {
@@ -74,9 +78,10 @@ func (ucr *updateConfigurer) RegisterFlags(fs *flag.FlagSet, cmd string, c *conf
c.ShouldFix = cmd == "fix"
fs.StringVar(&ucr.mode, "mode", "fix", "print: prints all of the updated BUILD files\n\tfix: rewrites all of the BUILD files in place\n\tdiff: computes the rewrite but then just does a diff")
fs.BoolVar(&uc.useIndex, "index", true, "when true, gazelle will build an index of libraries in the workspace for dependency resolution")
fs.BoolVar(&ucr.recursive, "r", true, "when true, gazelle will update subdirectories recursively")
fs.StringVar(&uc.patchPath, "patch", "", "when set with -mode=diff, gazelle will write to a file instead of stdout")
fs.Var(&gzflag.MultiFlag{Values: &ucr.knownImports}, "known_import", "import path for which external resolution is skipped (can specify multiple times)")
fs.StringVar(&ucr.repoConfigPath, "repo_config", "", "file where Gazelle should load repository configuration. Defaults to WORKSPACE.")
}
func (ucr *updateConfigurer) CheckFlags(fs *flag.FlagSet, c *config.Config) error {
@@ -113,12 +118,73 @@ func (ucr *updateConfigurer) CheckFlags(fs *flag.FlagSet, c *config.Config) erro
if ucr.recursive {
uc.walkMode = walk.VisitAllUpdateSubdirsMode
} else if uc.useIndex {
} else if c.IndexLibraries {
uc.walkMode = walk.VisitAllUpdateDirsMode
} else {
uc.walkMode = walk.UpdateDirsMode
}
// Load the repo configuration file (WORKSPACE by default) to find out
// names and prefixes of other go_repositories. This affects external
// dependency resolution for Go.
// TODO(jayconrod): Go-specific code should be moved to language/go.
if ucr.repoConfigPath == "" {
ucr.repoConfigPath = filepath.Join(c.RepoRoot, "WORKSPACE")
}
repoConfigFile, err := rule.LoadWorkspaceFile(ucr.repoConfigPath, "")
if err != nil && !os.IsNotExist(err) {
return err
} else if err == nil {
c.Repos, _, err = repo.ListRepositories(repoConfigFile)
if err != nil {
return err
}
}
for _, imp := range ucr.knownImports {
uc.repos = append(uc.repos, repo.Repo{
Name: label.ImportPathToBazelRepoName(imp),
GoPrefix: imp,
})
}
for _, r := range c.Repos {
if r.Kind() == "go_repository" {
uc.repos = append(uc.repos, repo.Repo{
Name: r.Name(),
GoPrefix: r.AttrString("importpath"),
})
}
}
// If the repo configuration file is not WORKSPACE, also load WORKSPACE
// and any declared macro files so we can apply fixes.
workspacePath := filepath.Join(c.RepoRoot, "WORKSPACE")
var workspace *rule.File
if ucr.repoConfigPath == workspacePath {
workspace = repoConfigFile
} else {
workspace, err = rule.LoadWorkspaceFile(workspacePath, "")
if err != nil && !os.IsNotExist(err) {
return err
}
}
if workspace != nil {
c.RepoName = findWorkspaceName(workspace)
_, repoFileMap, err := repo.ListRepositories(workspace)
if err != nil {
return err
}
seen := make(map[*rule.File]bool)
for _, f := range repoFileMap {
if !seen[f] {
uc.workspaceFiles = append(uc.workspaceFiles, f)
seen[f] = true
}
}
sort.Slice(uc.workspaceFiles, func(i, j int) bool {
return uc.workspaceFiles[i].Path < uc.workspaceFiles[j].Path
})
}
return nil
}
@@ -133,14 +199,24 @@ type visitRecord struct {
// the repository root. "" for the repository root itself.
pkgRel string
// c is the configuration for the directory with directives applied.
c *config.Config
// rules is a list of generated Go rules.
rules []*rule.Rule
// imports contains opaque import information for each rule in rules.
imports []interface{}
// empty is a list of empty Go rules that may be deleted.
empty []*rule.Rule
// file is the build file being processed.
file *rule.File
// mappedKinds are mapped kinds used during this visit.
mappedKinds []config.MappedKind
mappedKindInfo map[string]rule.KindInfo
}
type byPkgRel []visitRecord
@@ -156,31 +232,35 @@ var genericLoads = []rule.LoadInfo{
},
}
func runFixUpdate(cmd command, args []string) error {
func runFixUpdate(cmd command, args []string) (err error) {
cexts := make([]config.Configurer, 0, len(languages)+3)
cexts = append(cexts,
&config.CommonConfigurer{},
&updateConfigurer{},
&walk.Configurer{},
&resolve.Configurer{})
kindToResolver := make(map[string]resolve.Resolver)
mrslv := newMetaResolver()
kinds := make(map[string]rule.KindInfo)
loads := genericLoads
for _, lang := range languages {
cexts = append(cexts, lang)
for kind, info := range lang.Kinds() {
kindToResolver[kind] = lang
mrslv.AddBuiltin(kind, lang)
kinds[kind] = info
}
loads = append(loads, lang.Loads()...)
}
ruleIndex := resolve.NewRuleIndex(kindToResolver)
ruleIndex := resolve.NewRuleIndex(mrslv.Resolver)
c, err := newFixUpdateConfiguration(cmd, args, cexts, loads)
c, err := newFixUpdateConfiguration(cmd, args, cexts)
if err != nil {
return err
}
if err := fixRepoFiles(c, loads); err != nil {
return err
}
if cmd == fixCmd {
// Only check the version when "fix" is run. Generated build files
// frequently work with older version of rules_go, and we don't want to
@@ -195,7 +275,7 @@ func runFixUpdate(cmd command, args []string) error {
// If this file is ignored or if Gazelle was not asked to update this
// directory, just index the build file and move on.
if !update {
if uc.useIndex && f != nil {
if c.IndexLibraries && f != nil {
for _, r := range f.Rules {
ruleIndex.AddRule(c, r, f)
}
@@ -212,15 +292,43 @@ func runFixUpdate(cmd command, args []string) error {
// Generate rules.
var empty, gen []*rule.Rule
var imports []interface{}
for _, l := range languages {
lempty, lgen := l.GenerateRules(c, dir, rel, f, subdirs, regularFiles, genFiles, empty, gen)
empty = append(empty, lempty...)
gen = append(gen, lgen...)
res := l.GenerateRules(language.GenerateArgs{
Config: c,
Dir: dir,
Rel: rel,
File: f,
Subdirs: subdirs,
RegularFiles: regularFiles,
GenFiles: genFiles,
OtherEmpty: empty,
OtherGen: gen})
if len(res.Gen) != len(res.Imports) {
log.Panicf("%s: language %s generated %d rules but returned %d imports", rel, l.Name(), len(res.Gen), len(res.Imports))
}
empty = append(empty, res.Empty...)
gen = append(gen, res.Gen...)
imports = append(imports, res.Imports...)
}
if f == nil && len(gen) == 0 {
return
}
// Apply and record relevant kind mappings.
var (
mappedKinds []config.MappedKind
mappedKindInfo = make(map[string]rule.KindInfo)
)
for _, r := range gen {
if repl, ok := c.KindMap[r.Kind()]; ok {
mappedKindInfo[repl.KindName] = kinds[r.Kind()]
mappedKinds = append(mappedKinds, repl)
mrslv.MappedKind(rel, repl)
r.SetKind(repl.KindName)
}
}
// Insert or merge rules into the build file.
if f == nil {
f = rule.EmptyFile(filepath.Join(dir, c.DefaultBuildFileName()), rel)
@@ -228,18 +336,25 @@ func runFixUpdate(cmd command, args []string) error {
r.Insert(f)
}
} else {
merger.MergeFile(f, empty, gen, merger.PreResolve, kinds)
merger.MergeFile(f, empty, gen, merger.PreResolve,
unionKindInfoMaps(kinds, mappedKindInfo))
}
visits = append(visits, visitRecord{
pkgRel: rel,
rules: gen,
empty: empty,
file: f,
pkgRel: rel,
c: c,
rules: gen,
imports: imports,
empty: empty,
file: f,
mappedKinds: mappedKinds,
mappedKindInfo: mappedKindInfo,
})
// Add library rules to the dependency resolution table.
for _, r := range f.Rules {
ruleIndex.AddRule(c, r, f)
if c.IndexLibraries {
for _, r := range f.Rules {
ruleIndex.AddRule(c, r, f)
}
}
})
@@ -247,20 +362,31 @@ func runFixUpdate(cmd command, args []string) error {
ruleIndex.Finish()
// Resolve dependencies.
rc := repos.NewRemoteCache(uc.repos)
for _, v := range visits {
for _, r := range v.rules {
from := label.New(c.RepoName, v.pkgRel, r.Name())
kindToResolver[r.Kind()].Resolve(c, ruleIndex, rc, r, from)
rc, cleanupRc := repo.NewRemoteCache(uc.repos)
defer func() {
if cerr := cleanupRc(); err == nil && cerr != nil {
err = cerr
}
merger.MergeFile(v.file, v.empty, v.rules, merger.PostResolve, kinds)
}()
for _, v := range visits {
for i, r := range v.rules {
from := label.New(c.RepoName, v.pkgRel, r.Name())
mrslv.Resolver(r, v.pkgRel).Resolve(v.c, ruleIndex, rc, r, v.imports[i], from)
}
merger.MergeFile(v.file, v.empty, v.rules, merger.PostResolve,
unionKindInfoMaps(kinds, v.mappedKindInfo))
}
// Emit merged files.
var exit error
for _, v := range visits {
merger.FixLoads(v.file, loads)
if err := uc.emit(c, v.file); err != nil {
log.Print(err)
merger.FixLoads(v.file, applyKindMappings(v.mappedKinds, loads))
if err := uc.emit(v.c, v.file); err != nil {
if err == exitError {
exit = err
} else {
log.Print(err)
}
}
}
if uc.patchPath != "" {
@@ -269,10 +395,10 @@ func runFixUpdate(cmd command, args []string) error {
}
}
return nil
return exit
}
func newFixUpdateConfiguration(cmd command, args []string, cexts []config.Configurer, loads []rule.LoadInfo) (*config.Config, error) {
func newFixUpdateConfiguration(cmd command, args []string, cexts []config.Configurer) (*config.Config, error) {
c := config.New()
fs := flag.NewFlagSet("gazelle", flag.ContinueOnError)
@@ -280,9 +406,6 @@ func newFixUpdateConfiguration(cmd command, args []string, cexts []config.Config
// -h or -help were passed explicitly.
fs.Usage = func() {}
var knownImports []string
fs.Var(&gzflag.MultiFlag{Values: &knownImports}, "known_import", "import path for which external resolution is skipped (can specify multiple times)")
for _, cext := range cexts {
cext.RegisterFlags(fs, cmd.String(), c)
}
@@ -302,34 +425,6 @@ func newFixUpdateConfiguration(cmd command, args []string, cexts []config.Config
}
}
uc := getUpdateConfig(c)
workspacePath := filepath.Join(c.RepoRoot, "WORKSPACE")
if workspace, err := rule.LoadFile(workspacePath, ""); err != nil {
if !os.IsNotExist(err) {
return nil, err
}
} else {
if err := fixWorkspace(c, workspace, loads); err != nil {
return nil, err
}
c.RepoName = findWorkspaceName(workspace)
uc.repos = repos.ListRepositories(workspace)
}
repoPrefixes := make(map[string]bool)
for _, r := range uc.repos {
repoPrefixes[r.GoPrefix] = true
}
for _, imp := range knownImports {
if repoPrefixes[imp] {
continue
}
repo := repos.Repo{
Name: label.ImportPathToBazelRepoName(imp),
GoPrefix: imp,
}
uc.repos = append(uc.repos, repo)
}
return c, nil
}
@@ -362,7 +457,7 @@ FLAGS:
fs.PrintDefaults()
}
func fixWorkspace(c *config.Config, workspace *rule.File, loads []rule.LoadInfo) error {
func fixRepoFiles(c *config.Config, loads []rule.LoadInfo) error {
uc := getUpdateConfig(c)
if !c.ShouldFix {
return nil
@@ -377,12 +472,33 @@ func fixWorkspace(c *config.Config, workspace *rule.File, loads []rule.LoadInfo)
return nil
}
merger.FixWorkspace(workspace)
merger.FixLoads(workspace, loads)
if err := merger.CheckGazelleLoaded(workspace); err != nil {
return err
for _, f := range uc.workspaceFiles {
merger.FixLoads(f, loads)
if f.Path == filepath.Join(c.RepoRoot, "WORKSPACE") {
removeLegacyGoRepository(f)
if err := merger.CheckGazelleLoaded(f); err != nil {
return err
}
}
if err := uc.emit(c, f); err != nil {
return err
}
}
return nil
}
// removeLegacyGoRepository removes loads of go_repository from
// @io_bazel_rules_go. FixLoads should be called after this; it will load from
// @bazel_gazelle.
func removeLegacyGoRepository(f *rule.File) {
for _, l := range f.Loads {
if l.Name() == "@io_bazel_rules_go//go:def.bzl" {
l.Remove("go_repository")
if l.IsEmpty() {
l.Delete()
}
}
}
return uc.emit(c, workspace)
}
func findWorkspaceName(f *rule.File) string {
@@ -426,3 +542,51 @@ func findOutputPath(c *config.Config, f *rule.File) string {
}
return outputPath
}
func unionKindInfoMaps(a, b map[string]rule.KindInfo) map[string]rule.KindInfo {
if len(a) == 0 {
return b
}
if len(b) == 0 {
return a
}
result := make(map[string]rule.KindInfo, len(a)+len(b))
for _, m := range []map[string]rule.KindInfo{a, b} {
for k, v := range m {
result[k] = v
}
}
return result
}
// applyKindMappings returns a copy of LoadInfo that includes c.KindMap.
func applyKindMappings(mappedKinds []config.MappedKind, loads []rule.LoadInfo) []rule.LoadInfo {
if len(mappedKinds) == 0 {
return loads
}
// Add new RuleInfos or replace existing ones with merged ones.
mappedLoads := make([]rule.LoadInfo, len(loads))
copy(mappedLoads, loads)
for _, mappedKind := range mappedKinds {
mappedLoads = appendOrMergeKindMapping(mappedLoads, mappedKind)
}
return mappedLoads
}
// appendOrMergeKindMapping adds LoadInfo for the given replacement.
func appendOrMergeKindMapping(mappedLoads []rule.LoadInfo, mappedKind config.MappedKind) []rule.LoadInfo {
// If mappedKind.KindLoad already exists in the list, create a merged copy.
for i, load := range mappedLoads {
if load.Name == mappedKind.KindLoad {
mappedLoads[i].Symbols = append(load.Symbols, mappedKind.KindName)
return mappedLoads
}
}
// Add a new LoadInfo.
return append(mappedLoads, rule.LoadInfo{
Name: mappedKind.KindLoad,
Symbols: []string{mappedKind.KindName},
})
}

View File

@@ -20,8 +20,8 @@ import (
"os"
"path/filepath"
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/rule"
)
func fixFile(c *config.Config, f *rule.File) error {

View File

@@ -57,7 +57,11 @@ func main() {
log.SetFlags(0) // don't print timestamps
if err := run(os.Args[1:]); err != nil && err != flag.ErrHelp {
log.Fatal(err)
if err == exitError {
os.Exit(1)
} else {
log.Fatal(err)
}
}
}

View File

@@ -16,12 +16,12 @@ limitations under the License.
package main
import (
"github.com/bazelbuild/bazel-gazelle/internal/language"
"github.com/bazelbuild/bazel-gazelle/internal/language/go"
"github.com/bazelbuild/bazel-gazelle/internal/language/proto"
"github.com/bazelbuild/bazel-gazelle/language"
"github.com/bazelbuild/bazel-gazelle/language/go"
"github.com/bazelbuild/bazel-gazelle/language/proto"
)
var languages = []language.Language{
proto.New(),
golang.New(),
proto.NewLanguage(),
golang.NewLanguage(),
}

View File

@@ -0,0 +1,61 @@
/* Copyright 2019 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/resolve"
"github.com/bazelbuild/bazel-gazelle/rule"
)
// metaResolver provides a rule.Resolver for any rule.Rule.
type metaResolver struct {
// builtins provides a map of the language kinds to their resolver.
builtins map[string]resolve.Resolver
// mappedKinds provides a list of replacements used by File.Pkg.
mappedKinds map[string][]config.MappedKind
}
func newMetaResolver() *metaResolver {
return &metaResolver{
builtins: make(map[string]resolve.Resolver),
mappedKinds: make(map[string][]config.MappedKind),
}
}
// AddBuiltin registers a builtin kind with its info.
func (mr *metaResolver) AddBuiltin(kindName string, resolver resolve.Resolver) {
mr.builtins[kindName] = resolver
}
// MappedKind records the fact that the given mapping was applied while
// processing the given package.
func (mr *metaResolver) MappedKind(pkgRel string, kind config.MappedKind) {
mr.mappedKinds[pkgRel] = append(mr.mappedKinds[pkgRel], kind)
}
// Resolver returns a resolver for the given rule and package, and a bool
// indicating whether one was found. Empty string may be passed for pkgRel,
// which results in consulting the builtin kinds only.
func (mr metaResolver) Resolver(r *rule.Rule, pkgRel string) resolve.Resolver {
for _, mappedKind := range mr.mappedKinds[pkgRel] {
if mappedKind.KindName == r.Kind() {
return mr.builtins[mappedKind.FromKind]
}
}
return mr.builtins[r.Kind()]
}

View File

@@ -18,8 +18,8 @@ package main
import (
"os"
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/rule"
)
func printFile(c *config.Config, f *rule.File) error {

View File

@@ -21,20 +21,24 @@ import (
"fmt"
"os"
"path/filepath"
"sync"
"sort"
"strings"
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/merger"
"github.com/bazelbuild/bazel-gazelle/internal/repos"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/language"
"github.com/bazelbuild/bazel-gazelle/merger"
"github.com/bazelbuild/bazel-gazelle/repo"
"github.com/bazelbuild/bazel-gazelle/rule"
)
type updateReposFn func(c *updateReposConfig, oldFile *rule.File, kinds map[string]rule.KindInfo) error
type updateReposConfig struct {
fn updateReposFn
lockFilename string
importPaths []string
repoFilePath string
importPaths []string
macroFileName string
macroDefName string
pruneRules bool
workspace *rule.File
repoFileMap map[string]*rule.File
}
const updateReposName = "_update-repos"
@@ -45,36 +49,74 @@ func getUpdateReposConfig(c *config.Config) *updateReposConfig {
type updateReposConfigurer struct{}
func (_ *updateReposConfigurer) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config) {
uc := &updateReposConfig{}
c.Exts[updateReposName] = uc
fs.StringVar(&uc.lockFilename, "from_file", "", "Gazelle will translate repositories listed in this file into repository rules in WORKSPACE. Currently only dep's Gopkg.lock is supported.")
type macroFlag struct {
macroFileName *string
macroDefName *string
}
func (_ *updateReposConfigurer) CheckFlags(fs *flag.FlagSet, c *config.Config) error {
uc := getUpdateReposConfig(c)
switch {
case uc.lockFilename != "":
if len(fs.Args()) != 0 {
return fmt.Errorf("Got %d positional arguments with -from_file; wanted 0.\nTry -help for more information.", len(fs.Args()))
}
uc.fn = importFromLockFile
default:
if len(fs.Args()) == 0 {
return fmt.Errorf("No repositories specified\nTry -help for more information.")
}
uc.fn = updateImportPaths
uc.importPaths = fs.Args()
func (f macroFlag) Set(value string) error {
args := strings.Split(value, "%")
if len(args) != 2 {
return fmt.Errorf("Failure parsing to_macro: %s, expected format is macroFile%%defName", value)
}
if strings.HasPrefix(args[0], "..") {
return fmt.Errorf("Failure parsing to_macro: %s, macro file path %s should not start with \"..\"", value, args[0])
}
*f.macroFileName = args[0]
*f.macroDefName = args[1]
return nil
}
func (_ *updateReposConfigurer) KnownDirectives() []string { return nil }
func (f macroFlag) String() string {
return ""
}
func (_ *updateReposConfigurer) Configure(c *config.Config, rel string, f *rule.File) {}
func (*updateReposConfigurer) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config) {
uc := &updateReposConfig{}
c.Exts[updateReposName] = uc
fs.StringVar(&uc.repoFilePath, "from_file", "", "Gazelle will translate repositories listed in this file into repository rules in WORKSPACE or a .bzl macro function. Gopkg.lock and go.mod files are supported")
fs.Var(macroFlag{macroFileName: &uc.macroFileName, macroDefName: &uc.macroDefName}, "to_macro", "Tells Gazelle to write repository rules into a .bzl macro function rather than the WORKSPACE file. . The expected format is: macroFile%defName")
fs.BoolVar(&uc.pruneRules, "prune", false, "When enabled, Gazelle will remove rules that no longer have equivalent repos in the Gopkg.lock/go.mod file. Can only used with -from_file.")
}
func updateRepos(args []string) error {
func (*updateReposConfigurer) CheckFlags(fs *flag.FlagSet, c *config.Config) error {
uc := getUpdateReposConfig(c)
switch {
case uc.repoFilePath != "":
if len(fs.Args()) != 0 {
return fmt.Errorf("got %d positional arguments with -from_file; wanted 0.\nTry -help for more information.", len(fs.Args()))
}
default:
if len(fs.Args()) == 0 {
return fmt.Errorf("no repositories specified\nTry -help for more information.")
}
if uc.pruneRules {
return fmt.Errorf("the -prune option can only be used with -from_file")
}
uc.importPaths = fs.Args()
}
var err error
workspacePath := filepath.Join(c.RepoRoot, "WORKSPACE")
uc.workspace, err = rule.LoadWorkspaceFile(workspacePath, "")
if err != nil {
return fmt.Errorf("loading WORKSPACE file: %v", err)
}
c.Repos, uc.repoFileMap, err = repo.ListRepositories(uc.workspace)
if err != nil {
return fmt.Errorf("loading WORKSPACE file: %v", err)
}
return nil
}
func (*updateReposConfigurer) KnownDirectives() []string { return nil }
func (*updateReposConfigurer) Configure(c *config.Config, rel string, f *rule.File) {}
func updateRepos(args []string) (err error) {
// Build configuration with all languages.
cexts := make([]config.Configurer, 0, len(languages)+2)
cexts = append(cexts, &config.CommonConfigurer{}, &updateReposConfigurer{})
kinds := make(map[string]rule.KindInfo)
@@ -92,23 +134,140 @@ func updateRepos(args []string) error {
}
uc := getUpdateReposConfig(c)
workspacePath := filepath.Join(c.RepoRoot, "WORKSPACE")
f, err := rule.LoadFile(workspacePath, "")
if err != nil {
return fmt.Errorf("error loading %q: %v", workspacePath, err)
// TODO(jayconrod): move Go-specific RemoteCache logic to language/go.
var knownRepos []repo.Repo
for _, r := range c.Repos {
if r.Kind() == "go_repository" {
knownRepos = append(knownRepos, repo.Repo{
Name: r.Name(),
GoPrefix: r.AttrString("importpath"),
Remote: r.AttrString("remote"),
VCS: r.AttrString("vcs"),
})
}
}
merger.FixWorkspace(f)
rc, cleanup := repo.NewRemoteCache(knownRepos)
defer func() {
if cerr := cleanup(); err == nil && cerr != nil {
err = cerr
}
}()
if err := uc.fn(uc, f, kinds); err != nil {
// Fix the workspace file with each language.
for _, lang := range languages {
lang.Fix(c, uc.workspace)
}
// Generate rules from command language arguments or by importing a file.
var gen, empty []*rule.Rule
if uc.repoFilePath == "" {
gen, err = updateRepoImports(c, rc)
} else {
gen, empty, err = importRepos(c, rc)
}
if err != nil {
return err
}
merger.FixLoads(f, loads)
if err := merger.CheckGazelleLoaded(f); err != nil {
return err
// Organize generated and empty rules by file. A rule should go into the file
// it came from (by name). New rules should go into WORKSPACE or the file
// specified with -to_macro.
var newGen []*rule.Rule
genForFiles := make(map[*rule.File][]*rule.Rule)
emptyForFiles := make(map[*rule.File][]*rule.Rule)
for _, r := range gen {
f := uc.repoFileMap[r.Name()]
if f != nil {
genForFiles[f] = append(genForFiles[f], r)
} else {
newGen = append(newGen, r)
}
}
if err := f.Save(f.Path); err != nil {
return fmt.Errorf("error writing %q: %v", f.Path, err)
for _, r := range empty {
f := uc.repoFileMap[r.Name()]
if f == nil {
panic(fmt.Sprintf("empty rule %q for deletion that was not found", r.Name()))
}
emptyForFiles[f] = append(emptyForFiles[f], r)
}
var newGenFile *rule.File
var macroPath string
if uc.macroFileName != "" {
macroPath = filepath.Join(c.RepoRoot, filepath.Clean(uc.macroFileName))
}
for f := range genForFiles {
if macroPath == "" && filepath.Base(f.Path) == "WORKSPACE" ||
macroPath != "" && f.Path == macroPath && f.DefName == uc.macroDefName {
newGenFile = f
break
}
}
if newGenFile == nil {
if uc.macroFileName == "" {
newGenFile = uc.workspace
} else {
var err error
newGenFile, err = rule.LoadMacroFile(macroPath, "", uc.macroDefName)
if os.IsNotExist(err) {
newGenFile, err = rule.EmptyMacroFile(macroPath, "", uc.macroDefName)
if err != nil {
return fmt.Errorf("error creating %q: %v", macroPath, err)
}
} else if err != nil {
return fmt.Errorf("error loading %q: %v", macroPath, err)
}
}
}
genForFiles[newGenFile] = append(genForFiles[newGenFile], newGen...)
// Merge rules and fix loads in each file.
seenFile := make(map[*rule.File]bool)
sortedFiles := make([]*rule.File, 0, len(genForFiles))
for f := range genForFiles {
if !seenFile[f] {
seenFile[f] = true
sortedFiles = append(sortedFiles, f)
}
}
for f := range emptyForFiles {
if !seenFile[f] {
seenFile[f] = true
sortedFiles = append(sortedFiles, f)
}
}
sort.Slice(sortedFiles, func(i, j int) bool {
if cmp := strings.Compare(sortedFiles[i].Path, sortedFiles[j].Path); cmp != 0 {
return cmp < 0
}
return sortedFiles[i].DefName < sortedFiles[j].DefName
})
updatedFiles := make(map[string]*rule.File)
for _, f := range sortedFiles {
merger.MergeFile(f, emptyForFiles[f], genForFiles[f], merger.PreResolve, kinds)
merger.FixLoads(f, loads)
if f == uc.workspace {
if err := merger.CheckGazelleLoaded(f); err != nil {
return err
}
}
f.Sync()
if uf, ok := updatedFiles[f.Path]; ok {
uf.SyncMacroFile(f)
} else {
updatedFiles[f.Path] = f
}
}
for _, f := range sortedFiles {
if uf := updatedFiles[f.Path]; uf != nil {
if err := uf.Save(uf.Path); err != nil {
return err
}
delete(updatedFiles, f.Path)
}
}
return nil
}
@@ -154,47 +313,56 @@ file (currently only deps' Gopkg.lock is supported).
FLAGS:
`)
fs.PrintDefaults()
}
func updateImportPaths(c *updateReposConfig, f *rule.File, kinds map[string]rule.KindInfo) error {
rs := repos.ListRepositories(f)
rc := repos.NewRemoteCache(rs)
genRules := make([]*rule.Rule, len(c.importPaths))
errs := make([]error, len(c.importPaths))
var wg sync.WaitGroup
wg.Add(len(c.importPaths))
for i, imp := range c.importPaths {
go func(i int, imp string) {
defer wg.Done()
repo, err := repos.UpdateRepo(rc, imp)
if err != nil {
errs[i] = err
return
}
repo.Remote = "" // don't set these explicitly
repo.VCS = ""
rule := repos.GenerateRule(repo)
genRules[i] = rule
}(i, imp)
}
wg.Wait()
for _, err := range errs {
if err != nil {
return err
func updateRepoImports(c *config.Config, rc *repo.RemoteCache) (gen []*rule.Rule, err error) {
// TODO(jayconrod): let the user pick the language with a command line flag.
// For now, only use the first language that implements the interface.
uc := getUpdateReposConfig(c)
var updater language.RepoUpdater
for _, lang := range languages {
if u, ok := lang.(language.RepoUpdater); ok {
updater = u
break
}
}
merger.MergeFile(f, nil, genRules, merger.PreResolve, kinds)
return nil
}
func importFromLockFile(c *updateReposConfig, f *rule.File, kinds map[string]rule.KindInfo) error {
genRules, err := repos.ImportRepoRules(c.lockFilename)
if err != nil {
return err
if updater == nil {
return nil, fmt.Errorf("no languages can update repositories")
}
merger.MergeFile(f, nil, genRules, merger.PreResolve, kinds)
return nil
res := updater.UpdateRepos(language.UpdateReposArgs{
Config: c,
Imports: uc.importPaths,
Cache: rc,
})
return res.Gen, res.Error
}
func importRepos(c *config.Config, rc *repo.RemoteCache) (gen, empty []*rule.Rule, err error) {
uc := getUpdateReposConfig(c)
importSupported := false
var importer language.RepoImporter
for _, lang := range languages {
if i, ok := lang.(language.RepoImporter); ok {
importSupported = true
if i.CanImport(uc.repoFilePath) {
importer = i
break
}
}
}
if importer == nil {
if importSupported {
return nil, nil, fmt.Errorf("unknown file format: %s", uc.repoFilePath)
} else {
return nil, nil, fmt.Errorf("no supported languages can import configuration files")
}
}
res := importer.ImportRepos(language.ImportReposArgs{
Config: c,
Path: uc.repoFilePath,
Prune: uc.pruneRules,
Cache: rc,
})
return res.Gen, res.Empty, res.Error
}

View File

@@ -21,12 +21,12 @@ import (
"path/filepath"
"regexp"
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/repos"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/internal/version"
"github.com/bazelbuild/bazel-gazelle/repo"
)
var minimumRulesGoVersion = version.Version{0, 13, 0}
var minimumRulesGoVersion = version.Version{0, 19, 0}
// checkRulesGoVersion checks whether a compatible version of rules_go is
// being used in the workspace. A message will be logged if an incompatible
@@ -39,7 +39,7 @@ func checkRulesGoVersion(repoRoot string) {
const message = `Gazelle may not be compatible with this version of rules_go.
Update io_bazel_rules_go to a newer version in your WORKSPACE file.`
rulesGoPath, err := repos.FindExternalRepo(repoRoot, config.RulesGoRepoName)
rulesGoPath, err := repo.FindExternalRepo(repoRoot, config.RulesGoRepoName)
if err != nil {
return
}

View File

@@ -6,12 +6,12 @@ go_library(
"config.go",
"constants.go",
],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/internal/config",
importpath = "github.com/bazelbuild/bazel-gazelle/internal/config",
visibility = ["//vendor/github.com/bazelbuild/bazel-gazelle:__subpackages__"],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/config",
importpath = "github.com/bazelbuild/bazel-gazelle/config",
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/rule:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/wspace:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/rule:go_default_library",
],
)

View File

@@ -13,17 +13,28 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package config provides extensible configuration for Gazelle libraries.
//
// Packages may define Configurers which add support for new command-line
// options and directive comments in build files. Note that the
// language.Language interface embeds Configurer, so each language extension
// has the opportunity
//
// When Gazelle walks the directory trees in a repository, it calls the
// Configure method of each Configurer to produce a Config object.
// Config objects are passed as arguments to most functions in Gazelle, so
// this mechanism may be used to control many aspects of Gazelle's behavior.
package config
import (
"flag"
"fmt"
"go/build"
"log"
"path/filepath"
"strings"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/internal/wspace"
"github.com/bazelbuild/bazel-gazelle/rule"
)
// Config holds information about how Gazelle should run. This is based on
@@ -60,6 +71,20 @@ type Config struct {
// usage of deprecated rules.
ShouldFix bool
// IndexLibraries determines whether Gazelle should build an index of
// libraries in the workspace for dependency resolution
IndexLibraries bool
// KindMap maps from a kind name to its replacement. It provides a way for
// users to customize the kind of rules created by Gazelle, via
// # gazelle:map_kind.
KindMap map[string]MappedKind
// Repos is a list of repository rules declared in the main WORKSPACE file
// or in macros called by the main WORKSPACE file. This may affect rule
// generation and dependency resolution.
Repos []*rule.Rule
// Exts is a set of configurable extensions. Generally, each language
// has its own set of extensions, but other modules may provide their own
// extensions as well. Values in here may be populated by command line
@@ -67,6 +92,11 @@ type Config struct {
Exts map[string]interface{}
}
// MappedKind describes a replacement to use for a built-in kind.
type MappedKind struct {
FromKind, KindName, KindLoad string
}
func New() *Config {
return &Config{
ValidBuildFileNames: DefaultValidBuildFileNames,
@@ -83,11 +113,17 @@ func (c *Config) Clone() *Config {
for k, v := range c.Exts {
cc.Exts[k] = v
}
cc.KindMap = make(map[string]MappedKind)
for k, v := range c.KindMap {
cc.KindMap[k] = v
}
return &cc
}
var DefaultValidBuildFileNames = []string{"BUILD.bazel", "BUILD"}
// IsValidBuildFileName returns true if a file with the given base name
// should be treated as a build file.
func (c *Config) IsValidBuildFileName(name string) bool {
for _, n := range c.ValidBuildFileNames {
if name == n {
@@ -97,6 +133,7 @@ func (c *Config) IsValidBuildFileName(name string) bool {
return false
}
// DefaultBuildFileName returns the base name used to create new build files.
func (c *Config) DefaultBuildFileName() string {
return c.ValidBuildFileNames[0]
}
@@ -139,11 +176,13 @@ type Configurer interface {
// i.e., those that apply to Config itself and not to Config.Exts.
type CommonConfigurer struct {
repoRoot, buildFileNames, readBuildFilesDir, writeBuildFilesDir string
indexLibraries bool
}
func (cc *CommonConfigurer) RegisterFlags(fs *flag.FlagSet, cmd string, c *Config) {
fs.StringVar(&cc.repoRoot, "repo_root", "", "path to a directory which corresponds to go_prefix, otherwise gazelle searches for it.")
fs.StringVar(&cc.buildFileNames, "build_file_name", strings.Join(DefaultValidBuildFileNames, ","), "comma-separated list of valid build file names.\nThe first element of the list is the name of output build files to generate.")
fs.BoolVar(&cc.indexLibraries, "index", true, "when true, gazelle will build an index of libraries in the workspace for dependency resolution")
fs.StringVar(&cc.readBuildFilesDir, "experimental_read_build_files_dir", "", "path to a directory where build files should be read from (instead of -repo_root)")
fs.StringVar(&cc.writeBuildFilesDir, "experimental_write_build_files_dir", "", "path to a directory where build files should be written to (instead of -repo_root)")
}
@@ -177,12 +216,12 @@ func (cc *CommonConfigurer) CheckFlags(fs *flag.FlagSet, c *Config) error {
return fmt.Errorf("%s: failed to find absolute path of -write_build_files_dir: %v", cc.writeBuildFilesDir, err)
}
}
c.IndexLibraries = cc.indexLibraries
return nil
}
func (cc *CommonConfigurer) KnownDirectives() []string {
return []string{"build_file_name"}
return []string{"build_file_name", "map_kind"}
}
func (cc *CommonConfigurer) Configure(c *Config, rel string, f *rule.File) {
@@ -190,76 +229,24 @@ func (cc *CommonConfigurer) Configure(c *Config, rel string, f *rule.File) {
return
}
for _, d := range f.Directives {
if d.Key == "build_file_name" {
switch d.Key {
case "build_file_name":
c.ValidBuildFileNames = strings.Split(d.Value, ",")
case "map_kind":
vals := strings.Fields(d.Value)
if len(vals) != 3 {
log.Printf("expected three arguments (gazelle:map_kind from_kind to_kind load_file), got %v", vals)
continue
}
if c.KindMap == nil {
c.KindMap = make(map[string]MappedKind)
}
c.KindMap[vals[0]] = MappedKind{
FromKind: vals[0],
KindName: vals[1],
KindLoad: vals[2],
}
}
}
}
// CheckPrefix checks that a string may be used as a prefix. We forbid local
// (relative) imports and those beginning with "/". We allow the empty string,
// but generated rules must not have an empty importpath.
func CheckPrefix(prefix string) error {
if strings.HasPrefix(prefix, "/") || build.IsLocalImport(prefix) {
return fmt.Errorf("invalid prefix: %q", prefix)
}
return nil
}
// DependencyMode determines how imports of packages outside of the prefix
// are resolved.
type DependencyMode int
const (
// ExternalMode indicates imports should be resolved to external dependencies
// (declared in WORKSPACE).
ExternalMode DependencyMode = iota
// VendorMode indicates imports should be resolved to libraries in the
// vendor directory.
VendorMode
)
// DependencyModeFromString converts a string from the command line
// to a DependencyMode. Valid strings are "external", "vendor". An error will
// be returned for an invalid string.
func DependencyModeFromString(s string) (DependencyMode, error) {
switch s {
case "external":
return ExternalMode, nil
case "vendored":
return VendorMode, nil
default:
return 0, fmt.Errorf("unrecognized dependency mode: %q", s)
}
}
// ProtoMode determines how proto rules are generated.
type ProtoMode int
const (
// DefaultProtoMode generates proto_library and new grpc_proto_library rules.
// .pb.go files are excluded when there is a .proto file with a similar name.
DefaultProtoMode ProtoMode = iota
// DisableProtoMode ignores .proto files. .pb.go files are treated
// as normal sources.
DisableProtoMode
// LegacyProtoMode generates filegroups for .proto files if .pb.go files
// are present in the same directory.
LegacyProtoMode
)
func ProtoModeFromString(s string) (ProtoMode, error) {
switch s {
case "default":
return DefaultProtoMode, nil
case "disable":
return DisableProtoMode, nil
case "legacy":
return LegacyProtoMode, nil
default:
return 0, fmt.Errorf("unrecognized proto mode: %q", s)
}
}

View File

@@ -0,0 +1,27 @@
/* Copyright 2017 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package config
const (
// RulesGoRepoName is the canonical name of the rules_go repository. It must
// match the workspace name in WORKSPACE.
// TODO(jayconrod): move to language/go.
RulesGoRepoName = "io_bazel_rules_go"
// GazelleImportsKey is an internal attribute that lists imported packages
// on generated rules. It is replaced with "deps" during import resolution.
GazelleImportsKey = "_gazelle_imports"
)

View File

@@ -3,9 +3,9 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["flag.go"],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/internal/flag",
importpath = "github.com/bazelbuild/bazel-gazelle/internal/flag",
visibility = ["//vendor/github.com/bazelbuild/bazel-gazelle:__subpackages__"],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/flag",
importpath = "github.com/bazelbuild/bazel-gazelle/flag",
visibility = ["//visibility:public"],
)
filegroup(

View File

@@ -12,21 +12,29 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// Package flag provides some general-purpose types which satisfy the
// flag.Value interface.
package flag
import (
stdflag "flag"
"fmt"
"strings"
)
// MultiFlag allows repeated string flags to be collected into a slice
// MultiFlag collects repeated string flags into a slice.
type MultiFlag struct {
IsSet *bool
Values *[]string
}
var _ stdflag.Value = (*MultiFlag)(nil)
func (m *MultiFlag) Set(v string) error {
if m.IsSet != nil && !*m.IsSet {
*m.IsSet = true
*m.Values = nil // clear any default values
}
*m.Values = append(*m.Values, v)
return nil
}
@@ -58,3 +66,27 @@ func (f *ExplicitFlag) String() string {
}
return *f.Value
}
var _ stdflag.Value = (*AllowedStringFlag)(nil)
type AllowedStringFlag struct {
Allowed []string
Value *string
}
func (f *AllowedStringFlag) Set(v string) error {
for _, a := range f.Allowed {
if v == a {
*f.Value = v
return nil
}
}
return fmt.Errorf("Invalid argument %q. Possible values are: %s", v, strings.Join(f.Allowed, ", "))
}
func (f *AllowedStringFlag) String() string {
if f == nil || f.Value == nil {
return ""
}
return *f.Value
}

View File

@@ -1,68 +0,0 @@
/* Copyright 2017 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package config
const (
// RulesGoRepoName is the canonical name of the rules_go repository. It must
// match the workspace name in WORKSPACE.
RulesGoRepoName = "io_bazel_rules_go"
// DefaultLibName is the name of the default go_library rule in a Go
// package directory. It must be consistent to DEFAULT_LIB in go/private/common.bf.
DefaultLibName = "go_default_library"
// DefaultTestName is a name of an internal test corresponding to
// DefaultLibName. It does not need to be consistent to something but it
// just needs to be unique in the Bazel package
DefaultTestName = "go_default_test"
// DefaultXTestName is a name of an external test corresponding to
// DefaultLibName.
DefaultXTestName = "go_default_xtest"
// DefaultProtosName is the name of a filegroup created
// whenever the library contains .pb.go files
DefaultProtosName = "go_default_library_protos"
// DefaultCgoLibName is the name of the default cgo_library rule in a Go package directory.
DefaultCgoLibName = "cgo_default_library"
// GrpcCompilerLabel is the label for the gRPC compiler plugin, used in the
// "compilers" attribute of go_proto_library rules.
GrpcCompilerLabel = "@io_bazel_rules_go//proto:go_grpc"
// GazelleImportsKey is an internal attribute that lists imported packages
// on generated rules. It is replaced with "deps" during import resolution.
GazelleImportsKey = "_gazelle_imports"
)
// Language is the name of a programming langauge that Gazelle knows about.
// This is used to specify import paths.
type Language int
const (
// GoLang marks Go targets.
GoLang Language = iota
// ProtoLang marks protocol buffer targets.
ProtoLang
)
func (l Language) String() string {
switch l {
case GoLang:
return "go"
case ProtoLang:
return "proto"
default:
return "unknown"
}
}

View File

@@ -1,32 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["lang.go"],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/internal/language",
importpath = "github.com/bazelbuild/bazel-gazelle/internal/language",
visibility = ["//vendor/github.com/bazelbuild/bazel-gazelle:__subpackages__"],
deps = [
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/config:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/resolve:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/rule:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/language/go:all-srcs",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/language/proto:all-srcs",
],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -1,48 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"config.go",
"constants.go",
"fileinfo.go",
"fix.go",
"generate.go",
"kinds.go",
"known_go_imports.go",
"known_proto_imports.go",
"lang.go",
"package.go",
"resolve.go",
"std_package_list.go",
],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/internal/language/go",
importpath = "github.com/bazelbuild/bazel-gazelle/internal/language/go",
visibility = ["//vendor/github.com/bazelbuild/bazel-gazelle:__subpackages__"],
deps = [
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/config:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/flag:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/label:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/language:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/language/proto:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/pathtools:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/repos:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/resolve:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/rule:go_default_library",
"//vendor/github.com/bazelbuild/buildtools/build:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -1,158 +0,0 @@
// Generated by internal/language/proto/gen/gen_known_imports.go
// From internal/language/proto/proto.csv
package golang
import "github.com/bazelbuild/bazel-gazelle/internal/label"
var knownGoProtoImports = map[string]label.Label{
"github.com/golang/protobuf/ptypes/any": label.New("io_bazel_rules_go", "proto/wkt", "any_go_proto"),
"google.golang.org/genproto/protobuf/api": label.New("io_bazel_rules_go", "proto/wkt", "api_go_proto"),
"github.com/golang/protobuf/protoc-gen-go/plugin": label.New("io_bazel_rules_go", "proto/wkt", "compiler_plugin_go_proto"),
"github.com/golang/protobuf/protoc-gen-go/descriptor": label.New("io_bazel_rules_go", "proto/wkt", "descriptor_go_proto"),
"github.com/golang/protobuf/ptypes/duration": label.New("io_bazel_rules_go", "proto/wkt", "duration_go_proto"),
"github.com/golang/protobuf/ptypes/empty": label.New("io_bazel_rules_go", "proto/wkt", "empty_go_proto"),
"google.golang.org/genproto/protobuf/field_mask": label.New("io_bazel_rules_go", "proto/wkt", "field_mask_go_proto"),
"google.golang.org/genproto/protobuf/source_context": label.New("io_bazel_rules_go", "proto/wkt", "source_context_go_proto"),
"github.com/golang/protobuf/ptypes/struct": label.New("io_bazel_rules_go", "proto/wkt", "struct_go_proto"),
"github.com/golang/protobuf/ptypes/timestamp": label.New("io_bazel_rules_go", "proto/wkt", "timestamp_go_proto"),
"google.golang.org/genproto/protobuf/ptype": label.New("io_bazel_rules_go", "proto/wkt", "type_go_proto"),
"github.com/golang/protobuf/ptypes/wrappers": label.New("io_bazel_rules_go", "proto/wkt", "wrappers_go_proto"),
"google.golang.org/genproto/googleapis/api/annotations": label.New("go_googleapis", "google/api", "annotations_go_proto"),
"google.golang.org/genproto/googleapis/api/serviceconfig": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google.golang.org/genproto/googleapis/api/configchange": label.New("go_googleapis", "google/api", "configchange_go_proto"),
"google.golang.org/genproto/googleapis/api/distribution": label.New("go_googleapis", "google/api", "distribution_go_proto"),
"google.golang.org/genproto/googleapis/api": label.New("go_googleapis", "google/api", "api_go_proto"),
"google.golang.org/genproto/googleapis/api/expr/v1alpha1": label.New("go_googleapis", "google/api/expr/v1alpha1", "expr_go_proto"),
"google.golang.org/genproto/googleapis/api/expr/v1beta1": label.New("go_googleapis", "google/api/expr/v1beta1", "expr_go_proto"),
"google.golang.org/genproto/googleapis/api/httpbody": label.New("go_googleapis", "google/api", "httpbody_go_proto"),
"google.golang.org/genproto/googleapis/api/label": label.New("go_googleapis", "google/api", "label_go_proto"),
"google.golang.org/genproto/googleapis/api/metric": label.New("go_googleapis", "google/api", "metric_go_proto"),
"google.golang.org/genproto/googleapis/api/monitoredres": label.New("go_googleapis", "google/api", "monitoredres_go_proto"),
"google.golang.org/genproto/googleapis/api/servicecontrol/v1": label.New("go_googleapis", "google/api/servicecontrol/v1", "servicecontrol_go_proto"),
"google.golang.org/genproto/googleapis/api/servicemanagement/v1": label.New("go_googleapis", "google/api/servicemanagement/v1", "servicemanagement_go_proto"),
"google.golang.org/genproto/googleapis/appengine/legacy": label.New("go_googleapis", "google/appengine/legacy", "legacy_go_proto"),
"google.golang.org/genproto/googleapis/appengine/logging/v1": label.New("go_googleapis", "google/appengine/logging/v1", "logging_go_proto"),
"google.golang.org/genproto/googleapis/appengine/v1": label.New("go_googleapis", "google/appengine/v1", "appengine_go_proto"),
"google.golang.org/genproto/googleapis/assistant/embedded/v1alpha1": label.New("go_googleapis", "google/assistant/embedded/v1alpha1", "embedded_go_proto"),
"google.golang.org/genproto/googleapis/assistant/embedded/v1alpha2": label.New("go_googleapis", "google/assistant/embedded/v1alpha2", "embedded_go_proto"),
"google.golang.org/genproto/googleapis/bigtable/admin/cluster/v1": label.New("go_googleapis", "google/bigtable/admin/cluster/v1", "cluster_go_proto"),
"google.golang.org/genproto/googleapis/bigtable/admin/table/v1": label.New("go_googleapis", "google/bigtable/admin/table/v1", "table_go_proto"),
"google.golang.org/genproto/googleapis/bigtable/admin/v2": label.New("go_googleapis", "google/bigtable/admin/v2", "admin_go_proto"),
"google.golang.org/genproto/googleapis/bigtable/v1": label.New("go_googleapis", "google/bigtable/v1", "bigtable_go_proto"),
"google.golang.org/genproto/googleapis/bigtable/v2": label.New("go_googleapis", "google/bigtable/v2", "bigtable_go_proto"),
"google.golang.org/genproto/googleapis/bytestream": label.New("go_googleapis", "google/bytestream", "bytestream_go_proto"),
"google.golang.org/genproto/googleapis/cloud/asset/v1beta1": label.New("go_googleapis", "google/cloud/asset/v1beta1", "asset_go_proto"),
"google.golang.org/genproto/googleapis/cloud/audit": label.New("go_googleapis", "google/cloud/audit", "audit_go_proto"),
"google.golang.org/genproto/googleapis/cloud/automl/v1beta1": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_go_proto"),
"google.golang.org/genproto/googleapis/cloud/bigquery/datatransfer/v1": label.New("go_googleapis", "google/cloud/bigquery/datatransfer/v1", "datatransfer_go_proto"),
"google.golang.org/genproto/googleapis/cloud/bigquery/logging/v1": label.New("go_googleapis", "google/cloud/bigquery/logging/v1", "logging_go_proto"),
"google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1": label.New("go_googleapis", "google/cloud/bigquery/storage/v1beta1", "storage_go_proto"),
"google.golang.org/genproto/googleapis/cloud/billing/v1": label.New("go_googleapis", "google/cloud/billing/v1", "billing_go_proto"),
"google.golang.org/genproto/googleapis/cloud/dataproc/v1": label.New("go_googleapis", "google/cloud/dataproc/v1", "dataproc_go_proto"),
"google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2": label.New("go_googleapis", "google/cloud/dataproc/v1beta2", "dataproc_go_proto"),
"google.golang.org/genproto/googleapis/cloud/dialogflow/v2": label.New("go_googleapis", "google/cloud/dialogflow/v2", "dialogflow_go_proto"),
"google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_go_proto"),
"google.golang.org/genproto/googleapis/cloud/functions/v1beta2": label.New("go_googleapis", "google/cloud/functions/v1beta2", "functions_go_proto"),
"google.golang.org/genproto/googleapis/cloud/iot/v1": label.New("go_googleapis", "google/cloud/iot/v1", "iot_go_proto"),
"google.golang.org/genproto/googleapis/cloud/kms/v1": label.New("go_googleapis", "google/cloud/kms/v1", "kms_go_proto"),
"google.golang.org/genproto/googleapis/cloud/language/v1": label.New("go_googleapis", "google/cloud/language/v1", "language_go_proto"),
"google.golang.org/genproto/googleapis/cloud/language/v1beta1": label.New("go_googleapis", "google/cloud/language/v1beta1", "language_go_proto"),
"google.golang.org/genproto/googleapis/cloud/language/v1beta2": label.New("go_googleapis", "google/cloud/language/v1beta2", "language_go_proto"),
"google.golang.org/genproto/googleapis/cloud/location": label.New("go_googleapis", "google/cloud/location", "location_go_proto"),
"google.golang.org/genproto/googleapis/cloud/ml/v1": label.New("go_googleapis", "google/cloud/ml/v1", "ml_go_proto"),
"google.golang.org/genproto/googleapis/cloud/oslogin/common": label.New("go_googleapis", "google/cloud/oslogin/common", "common_go_proto"),
"google.golang.org/genproto/googleapis/cloud/oslogin/v1": label.New("go_googleapis", "google/cloud/oslogin/v1", "oslogin_go_proto"),
"google.golang.org/genproto/googleapis/cloud/oslogin/v1alpha": label.New("go_googleapis", "google/cloud/oslogin/v1alpha", "oslogin_go_proto"),
"google.golang.org/genproto/googleapis/cloud/oslogin/v1beta": label.New("go_googleapis", "google/cloud/oslogin/v1beta", "oslogin_go_proto"),
"google.golang.org/genproto/googleapis/cloud/redis/v1": label.New("go_googleapis", "google/cloud/redis/v1", "redis_go_proto"),
"google.golang.org/genproto/googleapis/cloud/redis/v1beta1": label.New("go_googleapis", "google/cloud/redis/v1beta1", "redis_go_proto"),
"google.golang.org/genproto/googleapis/cloud/resourcemanager/v2": label.New("go_googleapis", "google/cloud/resourcemanager/v2", "resourcemanager_go_proto"),
"google.golang.org/genproto/googleapis/cloud/runtimeconfig/v1beta1": label.New("go_googleapis", "google/cloud/runtimeconfig/v1beta1", "runtimeconfig_go_proto"),
"google.golang.org/genproto/googleapis/cloud/speech/v1": label.New("go_googleapis", "google/cloud/speech/v1", "speech_go_proto"),
"google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1": label.New("go_googleapis", "google/cloud/speech/v1p1beta1", "speech_go_proto"),
"google.golang.org/genproto/googleapis/cloud/support/common": label.New("go_googleapis", "google/cloud/support", "common_go_proto"),
"google.golang.org/genproto/googleapis/cloud/support/v1alpha1": label.New("go_googleapis", "google/cloud/support/v1alpha1", "support_go_proto"),
"google.golang.org/genproto/googleapis/cloud/tasks/v2beta2": label.New("go_googleapis", "google/cloud/tasks/v2beta2", "tasks_go_proto"),
"google.golang.org/genproto/googleapis/cloud/tasks/v2beta3": label.New("go_googleapis", "google/cloud/tasks/v2beta3", "tasks_go_proto"),
"google.golang.org/genproto/googleapis/cloud/texttospeech/v1": label.New("go_googleapis", "google/cloud/texttospeech/v1", "texttospeech_go_proto"),
"google.golang.org/genproto/googleapis/cloud/texttospeech/v1beta1": label.New("go_googleapis", "google/cloud/texttospeech/v1beta1", "texttospeech_go_proto"),
"google.golang.org/genproto/googleapis/cloud/videointelligence/v1": label.New("go_googleapis", "google/cloud/videointelligence/v1", "videointelligence_go_proto"),
"google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta1": label.New("go_googleapis", "google/cloud/videointelligence/v1beta1", "videointelligence_go_proto"),
"google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta2": label.New("go_googleapis", "google/cloud/videointelligence/v1beta2", "videointelligence_go_proto"),
"google.golang.org/genproto/googleapis/cloud/videointelligence/v1p1beta1": label.New("go_googleapis", "google/cloud/videointelligence/v1p1beta1", "videointelligence_go_proto"),
"google.golang.org/genproto/googleapis/cloud/videointelligence/v1p2beta1": label.New("go_googleapis", "google/cloud/videointelligence/v1p2beta1", "videointelligence_go_proto"),
"google.golang.org/genproto/googleapis/cloud/vision/v1": label.New("go_googleapis", "google/cloud/vision/v1", "vision_go_proto"),
"google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1": label.New("go_googleapis", "google/cloud/vision/v1p1beta1", "vision_go_proto"),
"google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1": label.New("go_googleapis", "google/cloud/vision/v1p2beta1", "vision_go_proto"),
"google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1": label.New("go_googleapis", "google/cloud/vision/v1p3beta1", "vision_go_proto"),
"google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha": label.New("go_googleapis", "google/cloud/websecurityscanner/v1alpha", "websecurityscanner_go_proto"),
"google.golang.org/genproto/googleapis/container/v1": label.New("go_googleapis", "google/container/v1", "container_go_proto"),
"google.golang.org/genproto/googleapis/container/v1alpha1": label.New("go_googleapis", "google/container/v1alpha1", "container_go_proto"),
"google.golang.org/genproto/googleapis/container/v1beta1": label.New("go_googleapis", "google/container/v1beta1", "container_go_proto"),
"google.golang.org/genproto/googleapis/datastore/admin/v1": label.New("go_googleapis", "google/datastore/admin/v1", "admin_go_proto"),
"google.golang.org/genproto/googleapis/datastore/admin/v1beta1": label.New("go_googleapis", "google/datastore/admin/v1beta1", "admin_go_proto"),
"google.golang.org/genproto/googleapis/datastore/v1": label.New("go_googleapis", "google/datastore/v1", "datastore_go_proto"),
"google.golang.org/genproto/googleapis/datastore/v1beta3": label.New("go_googleapis", "google/datastore/v1beta3", "datastore_go_proto"),
"google.golang.org/genproto/googleapis/devtools/build/v1": label.New("go_googleapis", "google/devtools/build/v1", "build_go_proto"),
"google.golang.org/genproto/googleapis/devtools/cloudbuild/v1": label.New("go_googleapis", "google/devtools/cloudbuild/v1", "cloudbuild_go_proto"),
"google.golang.org/genproto/googleapis/devtools/clouddebugger/v2": label.New("go_googleapis", "google/devtools/clouddebugger/v2", "clouddebugger_go_proto"),
"google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1": label.New("go_googleapis", "google/devtools/clouderrorreporting/v1beta1", "clouderrorreporting_go_proto"),
"google.golang.org/genproto/googleapis/devtools/cloudprofiler/v2": label.New("go_googleapis", "google/devtools/cloudprofiler/v2", "cloudprofiler_go_proto"),
"google.golang.org/genproto/googleapis/devtools/cloudtrace/v1": label.New("go_googleapis", "google/devtools/cloudtrace/v1", "cloudtrace_go_proto"),
"google.golang.org/genproto/googleapis/devtools/cloudtrace/v2": label.New("go_googleapis", "google/devtools/cloudtrace/v2", "cloudtrace_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1alpha1": label.New("go_googleapis", "google/devtools/containeranalysis/v1alpha1", "containeranalysis_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/attestation": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/attestation", "attestation_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/build": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/build", "build_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/common": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/common", "common_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1", "containeranalysis_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/deployment": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/deployment", "deployment_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/discovery": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/discovery", "discovery_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/grafeas", "grafeas_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/image": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/image", "image_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/package": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/package", "package_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/provenance": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/provenance", "provenance_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/source": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/source", "source_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/vulnerability": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/vulnerability", "vulnerability_go_proto"),
"google.golang.org/genproto/googleapis/devtools/remoteexecution/v1test": label.New("go_googleapis", "google/devtools/remoteexecution/v1test", "remoteexecution_go_proto"),
"google.golang.org/genproto/googleapis/devtools/remoteworkers/v1test2": label.New("go_googleapis", "google/devtools/remoteworkers/v1test2", "remoteworkers_go_proto"),
"google.golang.org/genproto/googleapis/devtools/resultstore/v2": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_go_proto"),
"google.golang.org/genproto/googleapis/devtools/source/v1": label.New("go_googleapis", "google/devtools/source/v1", "source_go_proto"),
"google.golang.org/genproto/googleapis/devtools/sourcerepo/v1": label.New("go_googleapis", "google/devtools/sourcerepo/v1", "sourcerepo_go_proto"),
"google.golang.org/genproto/googleapis/example/library/v1": label.New("go_googleapis", "google/example/library/v1", "library_go_proto"),
"google.golang.org/genproto/googleapis/firestore/admin/v1beta1": label.New("go_googleapis", "google/firestore/admin/v1beta1", "admin_go_proto"),
"google.golang.org/genproto/googleapis/firestore/admin/v1beta2": label.New("go_googleapis", "google/firestore/admin/v1beta2", "admin_go_proto"),
"google.golang.org/genproto/googleapis/firestore/v1beta1": label.New("go_googleapis", "google/firestore/v1beta1", "firestore_go_proto"),
"google.golang.org/genproto/googleapis/genomics/v1": label.New("go_googleapis", "google/genomics/v1", "genomics_go_proto"),
"google.golang.org/genproto/googleapis/genomics/v1alpha2": label.New("go_googleapis", "google/genomics/v1alpha2", "genomics_go_proto"),
"google.golang.org/genproto/googleapis/home/graph/v1": label.New("go_googleapis", "google/home/graph/v1", "graph_go_proto"),
"google.golang.org/genproto/googleapis/iam/admin/v1": label.New("go_googleapis", "google/iam/admin/v1", "admin_go_proto"),
"google.golang.org/genproto/googleapis/iam/credentials/v1": label.New("go_googleapis", "google/iam/credentials/v1", "credentials_go_proto"),
"google.golang.org/genproto/googleapis/iam/v1": label.New("go_googleapis", "google/iam/v1", "iam_go_proto"),
"google.golang.org/genproto/googleapis/iam/v1/logging": label.New("go_googleapis", "google/iam/v1/logging", "logging_go_proto"),
"google.golang.org/genproto/googleapis/logging/type": label.New("go_googleapis", "google/logging/type", "ltype_go_proto"),
"google.golang.org/genproto/googleapis/logging/v2": label.New("go_googleapis", "google/logging/v2", "logging_go_proto"),
"google.golang.org/genproto/googleapis/longrunning": label.New("go_googleapis", "google/longrunning", "longrunning_go_proto"),
"google.golang.org/genproto/googleapis/monitoring/v3": label.New("go_googleapis", "google/monitoring/v3", "monitoring_go_proto"),
"google.golang.org/genproto/googleapis/privacy/dlp/v2": label.New("go_googleapis", "google/privacy/dlp/v2", "dlp_go_proto"),
"google.golang.org/genproto/googleapis/pubsub/v1": label.New("go_googleapis", "google/pubsub/v1", "pubsub_go_proto"),
"google.golang.org/genproto/googleapis/pubsub/v1beta2": label.New("go_googleapis", "google/pubsub/v1beta2", "pubsub_go_proto"),
"google.golang.org/genproto/googleapis/rpc/code": label.New("go_googleapis", "google/rpc", "code_go_proto"),
"google.golang.org/genproto/googleapis/rpc/errdetails": label.New("go_googleapis", "google/rpc", "errdetails_go_proto"),
"google.golang.org/genproto/googleapis/rpc/status": label.New("go_googleapis", "google/rpc", "status_go_proto"),
"google.golang.org/genproto/googleapis/spanner/admin/database/v1": label.New("go_googleapis", "google/spanner/admin/database/v1", "database_go_proto"),
"google.golang.org/genproto/googleapis/spanner/admin/instance/v1": label.New("go_googleapis", "google/spanner/admin/instance/v1", "instance_go_proto"),
"google.golang.org/genproto/googleapis/spanner/v1": label.New("go_googleapis", "google/spanner/v1", "spanner_go_proto"),
"google.golang.org/genproto/googleapis/storagetransfer/v1": label.New("go_googleapis", "google/storagetransfer/v1", "storagetransfer_go_proto"),
"google.golang.org/genproto/googleapis/streetview/publish/v1": label.New("go_googleapis", "google/streetview/publish/v1", "publish_go_proto"),
"google.golang.org/genproto/googleapis/type/color": label.New("go_googleapis", "google/type", "color_go_proto"),
"google.golang.org/genproto/googleapis/type/date": label.New("go_googleapis", "google/type", "date_go_proto"),
"google.golang.org/genproto/googleapis/type/dayofweek": label.New("go_googleapis", "google/type", "dayofweek_go_proto"),
"google.golang.org/genproto/googleapis/type/latlng": label.New("go_googleapis", "google/type", "latlng_go_proto"),
"google.golang.org/genproto/googleapis/type/money": label.New("go_googleapis", "google/type", "money_go_proto"),
"google.golang.org/genproto/googleapis/type/postaladdress": label.New("go_googleapis", "google/type", "postaladdress_go_proto"),
"google.golang.org/genproto/googleapis/type/timeofday": label.New("go_googleapis", "google/type", "timeofday_go_proto"),
"google.golang.org/genproto/googleapis/watcher/v1": label.New("go_googleapis", "google/watcher/v1", "watcher_go_proto"),
}

View File

@@ -1,366 +0,0 @@
// Generated by internal/language/proto/gen/gen_known_imports.go
// From internal/language/proto/proto.csv
package golang
import "github.com/bazelbuild/bazel-gazelle/internal/label"
var knownProtoImports = map[string]label.Label{
"google/protobuf/any.proto": label.New("io_bazel_rules_go", "proto/wkt", "any_go_proto"),
"google/protobuf/api.proto": label.New("io_bazel_rules_go", "proto/wkt", "api_go_proto"),
"google/protobuf/compiler/plugin.proto": label.New("io_bazel_rules_go", "proto/wkt", "compiler_plugin_go_proto"),
"google/protobuf/descriptor.proto": label.New("io_bazel_rules_go", "proto/wkt", "descriptor_go_proto"),
"google/protobuf/duration.proto": label.New("io_bazel_rules_go", "proto/wkt", "duration_go_proto"),
"google/protobuf/empty.proto": label.New("io_bazel_rules_go", "proto/wkt", "empty_go_proto"),
"google/protobuf/field_mask.proto": label.New("io_bazel_rules_go", "proto/wkt", "field_mask_go_proto"),
"google/protobuf/source_context.proto": label.New("io_bazel_rules_go", "proto/wkt", "source_context_go_proto"),
"google/protobuf/struct.proto": label.New("io_bazel_rules_go", "proto/wkt", "struct_go_proto"),
"google/protobuf/timestamp.proto": label.New("io_bazel_rules_go", "proto/wkt", "timestamp_go_proto"),
"google/protobuf/type.proto": label.New("io_bazel_rules_go", "proto/wkt", "type_go_proto"),
"google/protobuf/wrappers.proto": label.New("io_bazel_rules_go", "proto/wkt", "wrappers_go_proto"),
"google/api/annotations.proto": label.New("go_googleapis", "google/api", "annotations_go_proto"),
"google/api/auth.proto": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google/api/backend.proto": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google/api/billing.proto": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google/api/config_change.proto": label.New("go_googleapis", "google/api", "configchange_go_proto"),
"google/api/consumer.proto": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google/api/context.proto": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google/api/control.proto": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google/api/distribution.proto": label.New("go_googleapis", "google/api", "distribution_go_proto"),
"google/api/documentation.proto": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google/api/endpoint.proto": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google/api/experimental/authorization_config.proto": label.New("go_googleapis", "google/api", "api_go_proto"),
"google/api/experimental/experimental.proto": label.New("go_googleapis", "google/api", "api_go_proto"),
"google/api/expr/v1alpha1/cel_service.proto": label.New("go_googleapis", "google/api/expr/v1alpha1", "expr_go_proto"),
"google/api/expr/v1alpha1/checked.proto": label.New("go_googleapis", "google/api/expr/v1alpha1", "expr_go_proto"),
"google/api/expr/v1alpha1/eval.proto": label.New("go_googleapis", "google/api/expr/v1alpha1", "expr_go_proto"),
"google/api/expr/v1alpha1/explain.proto": label.New("go_googleapis", "google/api/expr/v1alpha1", "expr_go_proto"),
"google/api/expr/v1alpha1/syntax.proto": label.New("go_googleapis", "google/api/expr/v1alpha1", "expr_go_proto"),
"google/api/expr/v1alpha1/value.proto": label.New("go_googleapis", "google/api/expr/v1alpha1", "expr_go_proto"),
"google/api/expr/v1beta1/decl.proto": label.New("go_googleapis", "google/api/expr/v1beta1", "expr_go_proto"),
"google/api/expr/v1beta1/eval.proto": label.New("go_googleapis", "google/api/expr/v1beta1", "expr_go_proto"),
"google/api/expr/v1beta1/expr.proto": label.New("go_googleapis", "google/api/expr/v1beta1", "expr_go_proto"),
"google/api/expr/v1beta1/source.proto": label.New("go_googleapis", "google/api/expr/v1beta1", "expr_go_proto"),
"google/api/expr/v1beta1/value.proto": label.New("go_googleapis", "google/api/expr/v1beta1", "expr_go_proto"),
"google/api/http.proto": label.New("go_googleapis", "google/api", "annotations_go_proto"),
"google/api/httpbody.proto": label.New("go_googleapis", "google/api", "httpbody_go_proto"),
"google/api/label.proto": label.New("go_googleapis", "google/api", "label_go_proto"),
"google/api/launch_stage.proto": label.New("go_googleapis", "google/api", "api_go_proto"),
"google/api/log.proto": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google/api/logging.proto": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google/api/metric.proto": label.New("go_googleapis", "google/api", "metric_go_proto"),
"google/api/monitored_resource.proto": label.New("go_googleapis", "google/api", "monitoredres_go_proto"),
"google/api/monitoring.proto": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google/api/quota.proto": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google/api/service.proto": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google/api/servicecontrol/v1/check_error.proto": label.New("go_googleapis", "google/api/servicecontrol/v1", "servicecontrol_go_proto"),
"google/api/servicecontrol/v1/distribution.proto": label.New("go_googleapis", "google/api/servicecontrol/v1", "servicecontrol_go_proto"),
"google/api/servicecontrol/v1/log_entry.proto": label.New("go_googleapis", "google/api/servicecontrol/v1", "servicecontrol_go_proto"),
"google/api/servicecontrol/v1/metric_value.proto": label.New("go_googleapis", "google/api/servicecontrol/v1", "servicecontrol_go_proto"),
"google/api/servicecontrol/v1/operation.proto": label.New("go_googleapis", "google/api/servicecontrol/v1", "servicecontrol_go_proto"),
"google/api/servicecontrol/v1/quota_controller.proto": label.New("go_googleapis", "google/api/servicecontrol/v1", "servicecontrol_go_proto"),
"google/api/servicecontrol/v1/service_controller.proto": label.New("go_googleapis", "google/api/servicecontrol/v1", "servicecontrol_go_proto"),
"google/api/servicemanagement/v1/resources.proto": label.New("go_googleapis", "google/api/servicemanagement/v1", "servicemanagement_go_proto"),
"google/api/servicemanagement/v1/servicemanager.proto": label.New("go_googleapis", "google/api/servicemanagement/v1", "servicemanagement_go_proto"),
"google/api/source_info.proto": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google/api/system_parameter.proto": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google/api/usage.proto": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google/appengine/legacy/audit_data.proto": label.New("go_googleapis", "google/appengine/legacy", "legacy_go_proto"),
"google/appengine/logging/v1/request_log.proto": label.New("go_googleapis", "google/appengine/logging/v1", "logging_go_proto"),
"google/appengine/v1/app_yaml.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_go_proto"),
"google/appengine/v1/appengine.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_go_proto"),
"google/appengine/v1/application.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_go_proto"),
"google/appengine/v1/audit_data.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_go_proto"),
"google/appengine/v1/deploy.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_go_proto"),
"google/appengine/v1/instance.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_go_proto"),
"google/appengine/v1/location.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_go_proto"),
"google/appengine/v1/operation.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_go_proto"),
"google/appengine/v1/service.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_go_proto"),
"google/appengine/v1/version.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_go_proto"),
"google/assistant/embedded/v1alpha1/embedded_assistant.proto": label.New("go_googleapis", "google/assistant/embedded/v1alpha1", "embedded_go_proto"),
"google/assistant/embedded/v1alpha2/embedded_assistant.proto": label.New("go_googleapis", "google/assistant/embedded/v1alpha2", "embedded_go_proto"),
"google/bigtable/admin/cluster/v1/bigtable_cluster_data.proto": label.New("go_googleapis", "google/bigtable/admin/cluster/v1", "cluster_go_proto"),
"google/bigtable/admin/cluster/v1/bigtable_cluster_service.proto": label.New("go_googleapis", "google/bigtable/admin/cluster/v1", "cluster_go_proto"),
"google/bigtable/admin/cluster/v1/bigtable_cluster_service_messages.proto": label.New("go_googleapis", "google/bigtable/admin/cluster/v1", "cluster_go_proto"),
"google/bigtable/admin/table/v1/bigtable_table_data.proto": label.New("go_googleapis", "google/bigtable/admin/table/v1", "table_go_proto"),
"google/bigtable/admin/table/v1/bigtable_table_service.proto": label.New("go_googleapis", "google/bigtable/admin/table/v1", "table_go_proto"),
"google/bigtable/admin/table/v1/bigtable_table_service_messages.proto": label.New("go_googleapis", "google/bigtable/admin/table/v1", "table_go_proto"),
"google/bigtable/admin/v2/bigtable_instance_admin.proto": label.New("go_googleapis", "google/bigtable/admin/v2", "admin_go_proto"),
"google/bigtable/admin/v2/bigtable_table_admin.proto": label.New("go_googleapis", "google/bigtable/admin/v2", "admin_go_proto"),
"google/bigtable/admin/v2/common.proto": label.New("go_googleapis", "google/bigtable/admin/v2", "admin_go_proto"),
"google/bigtable/admin/v2/instance.proto": label.New("go_googleapis", "google/bigtable/admin/v2", "admin_go_proto"),
"google/bigtable/admin/v2/table.proto": label.New("go_googleapis", "google/bigtable/admin/v2", "admin_go_proto"),
"google/bigtable/v1/bigtable_data.proto": label.New("go_googleapis", "google/bigtable/v1", "bigtable_go_proto"),
"google/bigtable/v1/bigtable_service.proto": label.New("go_googleapis", "google/bigtable/v1", "bigtable_go_proto"),
"google/bigtable/v1/bigtable_service_messages.proto": label.New("go_googleapis", "google/bigtable/v1", "bigtable_go_proto"),
"google/bigtable/v2/bigtable.proto": label.New("go_googleapis", "google/bigtable/v2", "bigtable_go_proto"),
"google/bigtable/v2/data.proto": label.New("go_googleapis", "google/bigtable/v2", "bigtable_go_proto"),
"google/bytestream/bytestream.proto": label.New("go_googleapis", "google/bytestream", "bytestream_go_proto"),
"google/cloud/asset/v1beta1/asset_service.proto": label.New("go_googleapis", "google/cloud/asset/v1beta1", "asset_go_proto"),
"google/cloud/asset/v1beta1/assets.proto": label.New("go_googleapis", "google/cloud/asset/v1beta1", "asset_go_proto"),
"google/cloud/audit/audit_log.proto": label.New("go_googleapis", "google/cloud/audit", "audit_go_proto"),
"google/cloud/automl/v1beta1/annotation_payload.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_go_proto"),
"google/cloud/automl/v1beta1/classification.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_go_proto"),
"google/cloud/automl/v1beta1/data_items.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_go_proto"),
"google/cloud/automl/v1beta1/dataset.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_go_proto"),
"google/cloud/automl/v1beta1/image.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_go_proto"),
"google/cloud/automl/v1beta1/io.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_go_proto"),
"google/cloud/automl/v1beta1/model.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_go_proto"),
"google/cloud/automl/v1beta1/model_evaluation.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_go_proto"),
"google/cloud/automl/v1beta1/operations.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_go_proto"),
"google/cloud/automl/v1beta1/prediction_service.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_go_proto"),
"google/cloud/automl/v1beta1/service.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_go_proto"),
"google/cloud/automl/v1beta1/text.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_go_proto"),
"google/cloud/automl/v1beta1/translation.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_go_proto"),
"google/cloud/bigquery/datatransfer/v1/datatransfer.proto": label.New("go_googleapis", "google/cloud/bigquery/datatransfer/v1", "datatransfer_go_proto"),
"google/cloud/bigquery/datatransfer/v1/transfer.proto": label.New("go_googleapis", "google/cloud/bigquery/datatransfer/v1", "datatransfer_go_proto"),
"google/cloud/bigquery/logging/v1/audit_data.proto": label.New("go_googleapis", "google/cloud/bigquery/logging/v1", "logging_go_proto"),
"google/cloud/bigquery/storage/v1beta1/avro.proto": label.New("go_googleapis", "google/cloud/bigquery/storage/v1beta1", "storage_go_proto"),
"google/cloud/bigquery/storage/v1beta1/read_options.proto": label.New("go_googleapis", "google/cloud/bigquery/storage/v1beta1", "storage_go_proto"),
"google/cloud/bigquery/storage/v1beta1/storage.proto": label.New("go_googleapis", "google/cloud/bigquery/storage/v1beta1", "storage_go_proto"),
"google/cloud/bigquery/storage/v1beta1/table_reference.proto": label.New("go_googleapis", "google/cloud/bigquery/storage/v1beta1", "storage_go_proto"),
"google/cloud/billing/v1/cloud_billing.proto": label.New("go_googleapis", "google/cloud/billing/v1", "billing_go_proto"),
"google/cloud/dataproc/v1/clusters.proto": label.New("go_googleapis", "google/cloud/dataproc/v1", "dataproc_go_proto"),
"google/cloud/dataproc/v1/jobs.proto": label.New("go_googleapis", "google/cloud/dataproc/v1", "dataproc_go_proto"),
"google/cloud/dataproc/v1/operations.proto": label.New("go_googleapis", "google/cloud/dataproc/v1", "dataproc_go_proto"),
"google/cloud/dataproc/v1beta2/clusters.proto": label.New("go_googleapis", "google/cloud/dataproc/v1beta2", "dataproc_go_proto"),
"google/cloud/dataproc/v1beta2/jobs.proto": label.New("go_googleapis", "google/cloud/dataproc/v1beta2", "dataproc_go_proto"),
"google/cloud/dataproc/v1beta2/operations.proto": label.New("go_googleapis", "google/cloud/dataproc/v1beta2", "dataproc_go_proto"),
"google/cloud/dataproc/v1beta2/shared.proto": label.New("go_googleapis", "google/cloud/dataproc/v1beta2", "dataproc_go_proto"),
"google/cloud/dataproc/v1beta2/workflow_templates.proto": label.New("go_googleapis", "google/cloud/dataproc/v1beta2", "dataproc_go_proto"),
"google/cloud/dialogflow/v2/agent.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2", "dialogflow_go_proto"),
"google/cloud/dialogflow/v2/context.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2", "dialogflow_go_proto"),
"google/cloud/dialogflow/v2/entity_type.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2", "dialogflow_go_proto"),
"google/cloud/dialogflow/v2/intent.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2", "dialogflow_go_proto"),
"google/cloud/dialogflow/v2/session.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2", "dialogflow_go_proto"),
"google/cloud/dialogflow/v2/session_entity_type.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2", "dialogflow_go_proto"),
"google/cloud/dialogflow/v2/webhook.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2", "dialogflow_go_proto"),
"google/cloud/dialogflow/v2beta1/agent.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_go_proto"),
"google/cloud/dialogflow/v2beta1/audio_config.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_go_proto"),
"google/cloud/dialogflow/v2beta1/context.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_go_proto"),
"google/cloud/dialogflow/v2beta1/document.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_go_proto"),
"google/cloud/dialogflow/v2beta1/entity_type.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_go_proto"),
"google/cloud/dialogflow/v2beta1/intent.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_go_proto"),
"google/cloud/dialogflow/v2beta1/knowledge_base.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_go_proto"),
"google/cloud/dialogflow/v2beta1/session.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_go_proto"),
"google/cloud/dialogflow/v2beta1/session_entity_type.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_go_proto"),
"google/cloud/dialogflow/v2beta1/webhook.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_go_proto"),
"google/cloud/functions/v1beta2/functions.proto": label.New("go_googleapis", "google/cloud/functions/v1beta2", "functions_go_proto"),
"google/cloud/functions/v1beta2/operations.proto": label.New("go_googleapis", "google/cloud/functions/v1beta2", "functions_go_proto"),
"google/cloud/iot/v1/device_manager.proto": label.New("go_googleapis", "google/cloud/iot/v1", "iot_go_proto"),
"google/cloud/iot/v1/resources.proto": label.New("go_googleapis", "google/cloud/iot/v1", "iot_go_proto"),
"google/cloud/kms/v1/resources.proto": label.New("go_googleapis", "google/cloud/kms/v1", "kms_go_proto"),
"google/cloud/kms/v1/service.proto": label.New("go_googleapis", "google/cloud/kms/v1", "kms_go_proto"),
"google/cloud/language/v1/language_service.proto": label.New("go_googleapis", "google/cloud/language/v1", "language_go_proto"),
"google/cloud/language/v1beta1/language_service.proto": label.New("go_googleapis", "google/cloud/language/v1beta1", "language_go_proto"),
"google/cloud/language/v1beta2/language_service.proto": label.New("go_googleapis", "google/cloud/language/v1beta2", "language_go_proto"),
"google/cloud/location/locations.proto": label.New("go_googleapis", "google/cloud/location", "location_go_proto"),
"google/cloud/ml/v1/job_service.proto": label.New("go_googleapis", "google/cloud/ml/v1", "ml_go_proto"),
"google/cloud/ml/v1/model_service.proto": label.New("go_googleapis", "google/cloud/ml/v1", "ml_go_proto"),
"google/cloud/ml/v1/operation_metadata.proto": label.New("go_googleapis", "google/cloud/ml/v1", "ml_go_proto"),
"google/cloud/ml/v1/prediction_service.proto": label.New("go_googleapis", "google/cloud/ml/v1", "ml_go_proto"),
"google/cloud/ml/v1/project_service.proto": label.New("go_googleapis", "google/cloud/ml/v1", "ml_go_proto"),
"google/cloud/oslogin/common/common.proto": label.New("go_googleapis", "google/cloud/oslogin/common", "common_go_proto"),
"google/cloud/oslogin/v1/oslogin.proto": label.New("go_googleapis", "google/cloud/oslogin/v1", "oslogin_go_proto"),
"google/cloud/oslogin/v1alpha/oslogin.proto": label.New("go_googleapis", "google/cloud/oslogin/v1alpha", "oslogin_go_proto"),
"google/cloud/oslogin/v1beta/oslogin.proto": label.New("go_googleapis", "google/cloud/oslogin/v1beta", "oslogin_go_proto"),
"google/cloud/redis/v1/cloud_redis.proto": label.New("go_googleapis", "google/cloud/redis/v1", "redis_go_proto"),
"google/cloud/redis/v1beta1/cloud_redis.proto": label.New("go_googleapis", "google/cloud/redis/v1beta1", "redis_go_proto"),
"google/cloud/resourcemanager/v2/folders.proto": label.New("go_googleapis", "google/cloud/resourcemanager/v2", "resourcemanager_go_proto"),
"google/cloud/runtimeconfig/v1beta1/resources.proto": label.New("go_googleapis", "google/cloud/runtimeconfig/v1beta1", "runtimeconfig_go_proto"),
"google/cloud/runtimeconfig/v1beta1/runtimeconfig.proto": label.New("go_googleapis", "google/cloud/runtimeconfig/v1beta1", "runtimeconfig_go_proto"),
"google/cloud/speech/v1/cloud_speech.proto": label.New("go_googleapis", "google/cloud/speech/v1", "speech_go_proto"),
"google/cloud/speech/v1p1beta1/cloud_speech.proto": label.New("go_googleapis", "google/cloud/speech/v1p1beta1", "speech_go_proto"),
"google/cloud/support/common.proto": label.New("go_googleapis", "google/cloud/support", "common_go_proto"),
"google/cloud/support/v1alpha1/cloud_support.proto": label.New("go_googleapis", "google/cloud/support/v1alpha1", "support_go_proto"),
"google/cloud/tasks/v2beta2/cloudtasks.proto": label.New("go_googleapis", "google/cloud/tasks/v2beta2", "tasks_go_proto"),
"google/cloud/tasks/v2beta2/queue.proto": label.New("go_googleapis", "google/cloud/tasks/v2beta2", "tasks_go_proto"),
"google/cloud/tasks/v2beta2/target.proto": label.New("go_googleapis", "google/cloud/tasks/v2beta2", "tasks_go_proto"),
"google/cloud/tasks/v2beta2/task.proto": label.New("go_googleapis", "google/cloud/tasks/v2beta2", "tasks_go_proto"),
"google/cloud/tasks/v2beta3/cloudtasks.proto": label.New("go_googleapis", "google/cloud/tasks/v2beta3", "tasks_go_proto"),
"google/cloud/tasks/v2beta3/queue.proto": label.New("go_googleapis", "google/cloud/tasks/v2beta3", "tasks_go_proto"),
"google/cloud/tasks/v2beta3/target.proto": label.New("go_googleapis", "google/cloud/tasks/v2beta3", "tasks_go_proto"),
"google/cloud/tasks/v2beta3/task.proto": label.New("go_googleapis", "google/cloud/tasks/v2beta3", "tasks_go_proto"),
"google/cloud/texttospeech/v1/cloud_tts.proto": label.New("go_googleapis", "google/cloud/texttospeech/v1", "texttospeech_go_proto"),
"google/cloud/texttospeech/v1beta1/cloud_tts.proto": label.New("go_googleapis", "google/cloud/texttospeech/v1beta1", "texttospeech_go_proto"),
"google/cloud/videointelligence/v1/video_intelligence.proto": label.New("go_googleapis", "google/cloud/videointelligence/v1", "videointelligence_go_proto"),
"google/cloud/videointelligence/v1beta1/video_intelligence.proto": label.New("go_googleapis", "google/cloud/videointelligence/v1beta1", "videointelligence_go_proto"),
"google/cloud/videointelligence/v1beta2/video_intelligence.proto": label.New("go_googleapis", "google/cloud/videointelligence/v1beta2", "videointelligence_go_proto"),
"google/cloud/videointelligence/v1p1beta1/video_intelligence.proto": label.New("go_googleapis", "google/cloud/videointelligence/v1p1beta1", "videointelligence_go_proto"),
"google/cloud/videointelligence/v1p2beta1/video_intelligence.proto": label.New("go_googleapis", "google/cloud/videointelligence/v1p2beta1", "videointelligence_go_proto"),
"google/cloud/vision/v1/geometry.proto": label.New("go_googleapis", "google/cloud/vision/v1", "vision_go_proto"),
"google/cloud/vision/v1/image_annotator.proto": label.New("go_googleapis", "google/cloud/vision/v1", "vision_go_proto"),
"google/cloud/vision/v1/text_annotation.proto": label.New("go_googleapis", "google/cloud/vision/v1", "vision_go_proto"),
"google/cloud/vision/v1/web_detection.proto": label.New("go_googleapis", "google/cloud/vision/v1", "vision_go_proto"),
"google/cloud/vision/v1p1beta1/geometry.proto": label.New("go_googleapis", "google/cloud/vision/v1p1beta1", "vision_go_proto"),
"google/cloud/vision/v1p1beta1/image_annotator.proto": label.New("go_googleapis", "google/cloud/vision/v1p1beta1", "vision_go_proto"),
"google/cloud/vision/v1p1beta1/text_annotation.proto": label.New("go_googleapis", "google/cloud/vision/v1p1beta1", "vision_go_proto"),
"google/cloud/vision/v1p1beta1/web_detection.proto": label.New("go_googleapis", "google/cloud/vision/v1p1beta1", "vision_go_proto"),
"google/cloud/vision/v1p2beta1/geometry.proto": label.New("go_googleapis", "google/cloud/vision/v1p2beta1", "vision_go_proto"),
"google/cloud/vision/v1p2beta1/image_annotator.proto": label.New("go_googleapis", "google/cloud/vision/v1p2beta1", "vision_go_proto"),
"google/cloud/vision/v1p2beta1/text_annotation.proto": label.New("go_googleapis", "google/cloud/vision/v1p2beta1", "vision_go_proto"),
"google/cloud/vision/v1p2beta1/web_detection.proto": label.New("go_googleapis", "google/cloud/vision/v1p2beta1", "vision_go_proto"),
"google/cloud/vision/v1p3beta1/geometry.proto": label.New("go_googleapis", "google/cloud/vision/v1p3beta1", "vision_go_proto"),
"google/cloud/vision/v1p3beta1/image_annotator.proto": label.New("go_googleapis", "google/cloud/vision/v1p3beta1", "vision_go_proto"),
"google/cloud/vision/v1p3beta1/product_search.proto": label.New("go_googleapis", "google/cloud/vision/v1p3beta1", "vision_go_proto"),
"google/cloud/vision/v1p3beta1/product_search_service.proto": label.New("go_googleapis", "google/cloud/vision/v1p3beta1", "vision_go_proto"),
"google/cloud/vision/v1p3beta1/text_annotation.proto": label.New("go_googleapis", "google/cloud/vision/v1p3beta1", "vision_go_proto"),
"google/cloud/vision/v1p3beta1/web_detection.proto": label.New("go_googleapis", "google/cloud/vision/v1p3beta1", "vision_go_proto"),
"google/cloud/websecurityscanner/v1alpha/crawled_url.proto": label.New("go_googleapis", "google/cloud/websecurityscanner/v1alpha", "websecurityscanner_go_proto"),
"google/cloud/websecurityscanner/v1alpha/finding.proto": label.New("go_googleapis", "google/cloud/websecurityscanner/v1alpha", "websecurityscanner_go_proto"),
"google/cloud/websecurityscanner/v1alpha/finding_addon.proto": label.New("go_googleapis", "google/cloud/websecurityscanner/v1alpha", "websecurityscanner_go_proto"),
"google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto": label.New("go_googleapis", "google/cloud/websecurityscanner/v1alpha", "websecurityscanner_go_proto"),
"google/cloud/websecurityscanner/v1alpha/scan_config.proto": label.New("go_googleapis", "google/cloud/websecurityscanner/v1alpha", "websecurityscanner_go_proto"),
"google/cloud/websecurityscanner/v1alpha/scan_run.proto": label.New("go_googleapis", "google/cloud/websecurityscanner/v1alpha", "websecurityscanner_go_proto"),
"google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto": label.New("go_googleapis", "google/cloud/websecurityscanner/v1alpha", "websecurityscanner_go_proto"),
"google/container/v1/cluster_service.proto": label.New("go_googleapis", "google/container/v1", "container_go_proto"),
"google/container/v1alpha1/cluster_service.proto": label.New("go_googleapis", "google/container/v1alpha1", "container_go_proto"),
"google/container/v1beta1/cluster_service.proto": label.New("go_googleapis", "google/container/v1beta1", "container_go_proto"),
"google/datastore/admin/v1/datastore_admin.proto": label.New("go_googleapis", "google/datastore/admin/v1", "admin_go_proto"),
"google/datastore/admin/v1/index.proto": label.New("go_googleapis", "google/datastore/admin/v1", "admin_go_proto"),
"google/datastore/admin/v1beta1/datastore_admin.proto": label.New("go_googleapis", "google/datastore/admin/v1beta1", "admin_go_proto"),
"google/datastore/v1/datastore.proto": label.New("go_googleapis", "google/datastore/v1", "datastore_go_proto"),
"google/datastore/v1/entity.proto": label.New("go_googleapis", "google/datastore/v1", "datastore_go_proto"),
"google/datastore/v1/query.proto": label.New("go_googleapis", "google/datastore/v1", "datastore_go_proto"),
"google/datastore/v1beta3/datastore.proto": label.New("go_googleapis", "google/datastore/v1beta3", "datastore_go_proto"),
"google/datastore/v1beta3/entity.proto": label.New("go_googleapis", "google/datastore/v1beta3", "datastore_go_proto"),
"google/datastore/v1beta3/query.proto": label.New("go_googleapis", "google/datastore/v1beta3", "datastore_go_proto"),
"google/devtools/build/v1/build_events.proto": label.New("go_googleapis", "google/devtools/build/v1", "build_go_proto"),
"google/devtools/build/v1/build_status.proto": label.New("go_googleapis", "google/devtools/build/v1", "build_go_proto"),
"google/devtools/build/v1/publish_build_event.proto": label.New("go_googleapis", "google/devtools/build/v1", "build_go_proto"),
"google/devtools/cloudbuild/v1/cloudbuild.proto": label.New("go_googleapis", "google/devtools/cloudbuild/v1", "cloudbuild_go_proto"),
"google/devtools/clouddebugger/v2/controller.proto": label.New("go_googleapis", "google/devtools/clouddebugger/v2", "clouddebugger_go_proto"),
"google/devtools/clouddebugger/v2/data.proto": label.New("go_googleapis", "google/devtools/clouddebugger/v2", "clouddebugger_go_proto"),
"google/devtools/clouddebugger/v2/debugger.proto": label.New("go_googleapis", "google/devtools/clouddebugger/v2", "clouddebugger_go_proto"),
"google/devtools/clouderrorreporting/v1beta1/common.proto": label.New("go_googleapis", "google/devtools/clouderrorreporting/v1beta1", "clouderrorreporting_go_proto"),
"google/devtools/clouderrorreporting/v1beta1/error_group_service.proto": label.New("go_googleapis", "google/devtools/clouderrorreporting/v1beta1", "clouderrorreporting_go_proto"),
"google/devtools/clouderrorreporting/v1beta1/error_stats_service.proto": label.New("go_googleapis", "google/devtools/clouderrorreporting/v1beta1", "clouderrorreporting_go_proto"),
"google/devtools/clouderrorreporting/v1beta1/report_errors_service.proto": label.New("go_googleapis", "google/devtools/clouderrorreporting/v1beta1", "clouderrorreporting_go_proto"),
"google/devtools/cloudprofiler/v2/profiler.proto": label.New("go_googleapis", "google/devtools/cloudprofiler/v2", "cloudprofiler_go_proto"),
"google/devtools/cloudtrace/v1/trace.proto": label.New("go_googleapis", "google/devtools/cloudtrace/v1", "cloudtrace_go_proto"),
"google/devtools/cloudtrace/v2/trace.proto": label.New("go_googleapis", "google/devtools/cloudtrace/v2", "cloudtrace_go_proto"),
"google/devtools/cloudtrace/v2/tracing.proto": label.New("go_googleapis", "google/devtools/cloudtrace/v2", "cloudtrace_go_proto"),
"google/devtools/containeranalysis/v1alpha1/bill_of_materials.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1alpha1", "containeranalysis_go_proto"),
"google/devtools/containeranalysis/v1alpha1/containeranalysis.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1alpha1", "containeranalysis_go_proto"),
"google/devtools/containeranalysis/v1alpha1/image_basis.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1alpha1", "containeranalysis_go_proto"),
"google/devtools/containeranalysis/v1alpha1/package_vulnerability.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1alpha1", "containeranalysis_go_proto"),
"google/devtools/containeranalysis/v1alpha1/provenance.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1alpha1", "containeranalysis_go_proto"),
"google/devtools/containeranalysis/v1alpha1/source_context.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1alpha1", "containeranalysis_go_proto"),
"google/devtools/containeranalysis/v1beta1/attestation/attestation.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/attestation", "attestation_go_proto"),
"google/devtools/containeranalysis/v1beta1/build/build.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/build", "build_go_proto"),
"google/devtools/containeranalysis/v1beta1/common/common.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/common", "common_go_proto"),
"google/devtools/containeranalysis/v1beta1/containeranalysis.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1", "containeranalysis_go_proto"),
"google/devtools/containeranalysis/v1beta1/deployment/deployment.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/deployment", "deployment_go_proto"),
"google/devtools/containeranalysis/v1beta1/discovery/discovery.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/discovery", "discovery_go_proto"),
"google/devtools/containeranalysis/v1beta1/grafeas/grafeas.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/grafeas", "grafeas_go_proto"),
"google/devtools/containeranalysis/v1beta1/image/image.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/image", "image_go_proto"),
"google/devtools/containeranalysis/v1beta1/package/package.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/package", "package_go_proto"),
"google/devtools/containeranalysis/v1beta1/provenance/provenance.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/provenance", "provenance_go_proto"),
"google/devtools/containeranalysis/v1beta1/source/source.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/source", "source_go_proto"),
"google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/vulnerability", "vulnerability_go_proto"),
"google/devtools/remoteexecution/v1test/remote_execution.proto": label.New("go_googleapis", "google/devtools/remoteexecution/v1test", "remoteexecution_go_proto"),
"google/devtools/remoteworkers/v1test2/bots.proto": label.New("go_googleapis", "google/devtools/remoteworkers/v1test2", "remoteworkers_go_proto"),
"google/devtools/remoteworkers/v1test2/command.proto": label.New("go_googleapis", "google/devtools/remoteworkers/v1test2", "remoteworkers_go_proto"),
"google/devtools/remoteworkers/v1test2/tasks.proto": label.New("go_googleapis", "google/devtools/remoteworkers/v1test2", "remoteworkers_go_proto"),
"google/devtools/remoteworkers/v1test2/worker.proto": label.New("go_googleapis", "google/devtools/remoteworkers/v1test2", "remoteworkers_go_proto"),
"google/devtools/resultstore/v2/action.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_go_proto"),
"google/devtools/resultstore/v2/common.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_go_proto"),
"google/devtools/resultstore/v2/configuration.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_go_proto"),
"google/devtools/resultstore/v2/configured_target.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_go_proto"),
"google/devtools/resultstore/v2/coverage.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_go_proto"),
"google/devtools/resultstore/v2/coverage_summary.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_go_proto"),
"google/devtools/resultstore/v2/file.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_go_proto"),
"google/devtools/resultstore/v2/file_set.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_go_proto"),
"google/devtools/resultstore/v2/invocation.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_go_proto"),
"google/devtools/resultstore/v2/resultstore_download.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_go_proto"),
"google/devtools/resultstore/v2/resultstore_file_download.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_go_proto"),
"google/devtools/resultstore/v2/target.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_go_proto"),
"google/devtools/resultstore/v2/test_suite.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_go_proto"),
"google/devtools/source/v1/source_context.proto": label.New("go_googleapis", "google/devtools/source/v1", "source_go_proto"),
"google/devtools/sourcerepo/v1/sourcerepo.proto": label.New("go_googleapis", "google/devtools/sourcerepo/v1", "sourcerepo_go_proto"),
"google/example/library/v1/library.proto": label.New("go_googleapis", "google/example/library/v1", "library_go_proto"),
"google/firestore/admin/v1beta1/firestore_admin.proto": label.New("go_googleapis", "google/firestore/admin/v1beta1", "admin_go_proto"),
"google/firestore/admin/v1beta1/index.proto": label.New("go_googleapis", "google/firestore/admin/v1beta1", "admin_go_proto"),
"google/firestore/admin/v1beta2/field.proto": label.New("go_googleapis", "google/firestore/admin/v1beta2", "admin_go_proto"),
"google/firestore/admin/v1beta2/firestore_admin.proto": label.New("go_googleapis", "google/firestore/admin/v1beta2", "admin_go_proto"),
"google/firestore/admin/v1beta2/index.proto": label.New("go_googleapis", "google/firestore/admin/v1beta2", "admin_go_proto"),
"google/firestore/admin/v1beta2/operation.proto": label.New("go_googleapis", "google/firestore/admin/v1beta2", "admin_go_proto"),
"google/firestore/v1beta1/common.proto": label.New("go_googleapis", "google/firestore/v1beta1", "firestore_go_proto"),
"google/firestore/v1beta1/document.proto": label.New("go_googleapis", "google/firestore/v1beta1", "firestore_go_proto"),
"google/firestore/v1beta1/firestore.proto": label.New("go_googleapis", "google/firestore/v1beta1", "firestore_go_proto"),
"google/firestore/v1beta1/query.proto": label.New("go_googleapis", "google/firestore/v1beta1", "firestore_go_proto"),
"google/firestore/v1beta1/write.proto": label.New("go_googleapis", "google/firestore/v1beta1", "firestore_go_proto"),
"google/genomics/v1/annotations.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_go_proto"),
"google/genomics/v1/cigar.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_go_proto"),
"google/genomics/v1/datasets.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_go_proto"),
"google/genomics/v1/operations.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_go_proto"),
"google/genomics/v1/position.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_go_proto"),
"google/genomics/v1/range.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_go_proto"),
"google/genomics/v1/readalignment.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_go_proto"),
"google/genomics/v1/readgroup.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_go_proto"),
"google/genomics/v1/readgroupset.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_go_proto"),
"google/genomics/v1/reads.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_go_proto"),
"google/genomics/v1/references.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_go_proto"),
"google/genomics/v1/variants.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_go_proto"),
"google/genomics/v1alpha2/pipelines.proto": label.New("go_googleapis", "google/genomics/v1alpha2", "genomics_go_proto"),
"google/home/graph/v1/device.proto": label.New("go_googleapis", "google/home/graph/v1", "graph_go_proto"),
"google/home/graph/v1/homegraph.proto": label.New("go_googleapis", "google/home/graph/v1", "graph_go_proto"),
"google/iam/admin/v1/iam.proto": label.New("go_googleapis", "google/iam/admin/v1", "admin_go_proto"),
"google/iam/credentials/v1/common.proto": label.New("go_googleapis", "google/iam/credentials/v1", "credentials_go_proto"),
"google/iam/credentials/v1/iamcredentials.proto": label.New("go_googleapis", "google/iam/credentials/v1", "credentials_go_proto"),
"google/iam/v1/iam_policy.proto": label.New("go_googleapis", "google/iam/v1", "iam_go_proto"),
"google/iam/v1/logging/audit_data.proto": label.New("go_googleapis", "google/iam/v1/logging", "logging_go_proto"),
"google/iam/v1/policy.proto": label.New("go_googleapis", "google/iam/v1", "iam_go_proto"),
"google/logging/type/http_request.proto": label.New("go_googleapis", "google/logging/type", "ltype_go_proto"),
"google/logging/type/log_severity.proto": label.New("go_googleapis", "google/logging/type", "ltype_go_proto"),
"google/logging/v2/log_entry.proto": label.New("go_googleapis", "google/logging/v2", "logging_go_proto"),
"google/logging/v2/logging.proto": label.New("go_googleapis", "google/logging/v2", "logging_go_proto"),
"google/logging/v2/logging_config.proto": label.New("go_googleapis", "google/logging/v2", "logging_go_proto"),
"google/logging/v2/logging_metrics.proto": label.New("go_googleapis", "google/logging/v2", "logging_go_proto"),
"google/longrunning/operations.proto": label.New("go_googleapis", "google/longrunning", "longrunning_go_proto"),
"google/monitoring/v3/alert.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_go_proto"),
"google/monitoring/v3/alert_service.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_go_proto"),
"google/monitoring/v3/common.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_go_proto"),
"google/monitoring/v3/dropped_labels.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_go_proto"),
"google/monitoring/v3/group.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_go_proto"),
"google/monitoring/v3/group_service.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_go_proto"),
"google/monitoring/v3/metric.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_go_proto"),
"google/monitoring/v3/metric_service.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_go_proto"),
"google/monitoring/v3/mutation_record.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_go_proto"),
"google/monitoring/v3/notification.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_go_proto"),
"google/monitoring/v3/notification_service.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_go_proto"),
"google/monitoring/v3/span_context.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_go_proto"),
"google/monitoring/v3/uptime.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_go_proto"),
"google/monitoring/v3/uptime_service.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_go_proto"),
"google/privacy/dlp/v2/dlp.proto": label.New("go_googleapis", "google/privacy/dlp/v2", "dlp_go_proto"),
"google/privacy/dlp/v2/storage.proto": label.New("go_googleapis", "google/privacy/dlp/v2", "dlp_go_proto"),
"google/pubsub/v1/pubsub.proto": label.New("go_googleapis", "google/pubsub/v1", "pubsub_go_proto"),
"google/pubsub/v1beta2/pubsub.proto": label.New("go_googleapis", "google/pubsub/v1beta2", "pubsub_go_proto"),
"google/rpc/code.proto": label.New("go_googleapis", "google/rpc", "code_go_proto"),
"google/rpc/error_details.proto": label.New("go_googleapis", "google/rpc", "errdetails_go_proto"),
"google/rpc/status.proto": label.New("go_googleapis", "google/rpc", "status_go_proto"),
"google/spanner/admin/database/v1/spanner_database_admin.proto": label.New("go_googleapis", "google/spanner/admin/database/v1", "database_go_proto"),
"google/spanner/admin/instance/v1/spanner_instance_admin.proto": label.New("go_googleapis", "google/spanner/admin/instance/v1", "instance_go_proto"),
"google/spanner/v1/keys.proto": label.New("go_googleapis", "google/spanner/v1", "spanner_go_proto"),
"google/spanner/v1/mutation.proto": label.New("go_googleapis", "google/spanner/v1", "spanner_go_proto"),
"google/spanner/v1/query_plan.proto": label.New("go_googleapis", "google/spanner/v1", "spanner_go_proto"),
"google/spanner/v1/result_set.proto": label.New("go_googleapis", "google/spanner/v1", "spanner_go_proto"),
"google/spanner/v1/spanner.proto": label.New("go_googleapis", "google/spanner/v1", "spanner_go_proto"),
"google/spanner/v1/transaction.proto": label.New("go_googleapis", "google/spanner/v1", "spanner_go_proto"),
"google/spanner/v1/type.proto": label.New("go_googleapis", "google/spanner/v1", "spanner_go_proto"),
"google/storagetransfer/v1/transfer.proto": label.New("go_googleapis", "google/storagetransfer/v1", "storagetransfer_go_proto"),
"google/storagetransfer/v1/transfer_types.proto": label.New("go_googleapis", "google/storagetransfer/v1", "storagetransfer_go_proto"),
"google/streetview/publish/v1/resources.proto": label.New("go_googleapis", "google/streetview/publish/v1", "publish_go_proto"),
"google/streetview/publish/v1/rpcmessages.proto": label.New("go_googleapis", "google/streetview/publish/v1", "publish_go_proto"),
"google/streetview/publish/v1/streetview_publish.proto": label.New("go_googleapis", "google/streetview/publish/v1", "publish_go_proto"),
"google/type/color.proto": label.New("go_googleapis", "google/type", "color_go_proto"),
"google/type/date.proto": label.New("go_googleapis", "google/type", "date_go_proto"),
"google/type/dayofweek.proto": label.New("go_googleapis", "google/type", "dayofweek_go_proto"),
"google/type/latlng.proto": label.New("go_googleapis", "google/type", "latlng_go_proto"),
"google/type/money.proto": label.New("go_googleapis", "google/type", "money_go_proto"),
"google/type/postal_address.proto": label.New("go_googleapis", "google/type", "postaladdress_go_proto"),
"google/type/timeofday.proto": label.New("go_googleapis", "google/type", "timeofday_go_proto"),
"google/watcher/v1/watch.proto": label.New("go_googleapis", "google/watcher/v1", "watcher_go_proto"),
}

View File

@@ -1,284 +0,0 @@
/* Copyright 2017 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Generated by gen_std_package_list.go
// DO NOT EDIT
package golang
var stdPackages = map[string]bool{
"archive/tar": true,
"archive/zip": true,
"bufio": true,
"bytes": true,
"cmd/addr2line": true,
"cmd/api": true,
"cmd/asm": true,
"cmd/asm/internal/arch": true,
"cmd/asm/internal/asm": true,
"cmd/asm/internal/flags": true,
"cmd/asm/internal/lex": true,
"cmd/buildid": true,
"cmd/cgo": true,
"cmd/compile": true,
"cmd/compile/internal/amd64": true,
"cmd/compile/internal/arm": true,
"cmd/compile/internal/arm64": true,
"cmd/compile/internal/gc": true,
"cmd/compile/internal/mips": true,
"cmd/compile/internal/mips64": true,
"cmd/compile/internal/ppc64": true,
"cmd/compile/internal/s390x": true,
"cmd/compile/internal/ssa": true,
"cmd/compile/internal/syntax": true,
"cmd/compile/internal/test": true,
"cmd/compile/internal/types": true,
"cmd/compile/internal/x86": true,
"cmd/cover": true,
"cmd/dist": true,
"cmd/doc": true,
"cmd/fix": true,
"cmd/go": true,
"cmd/go/internal/base": true,
"cmd/go/internal/bug": true,
"cmd/go/internal/cache": true,
"cmd/go/internal/cfg": true,
"cmd/go/internal/clean": true,
"cmd/go/internal/cmdflag": true,
"cmd/go/internal/doc": true,
"cmd/go/internal/envcmd": true,
"cmd/go/internal/fix": true,
"cmd/go/internal/fmtcmd": true,
"cmd/go/internal/generate": true,
"cmd/go/internal/get": true,
"cmd/go/internal/help": true,
"cmd/go/internal/list": true,
"cmd/go/internal/load": true,
"cmd/go/internal/run": true,
"cmd/go/internal/str": true,
"cmd/go/internal/test": true,
"cmd/go/internal/tool": true,
"cmd/go/internal/version": true,
"cmd/go/internal/vet": true,
"cmd/go/internal/web": true,
"cmd/go/internal/work": true,
"cmd/gofmt": true,
"cmd/internal/bio": true,
"cmd/internal/browser": true,
"cmd/internal/buildid": true,
"cmd/internal/dwarf": true,
"cmd/internal/edit": true,
"cmd/internal/gcprog": true,
"cmd/internal/goobj": true,
"cmd/internal/obj": true,
"cmd/internal/obj/arm": true,
"cmd/internal/obj/arm64": true,
"cmd/internal/obj/mips": true,
"cmd/internal/obj/ppc64": true,
"cmd/internal/obj/s390x": true,
"cmd/internal/obj/x86": true,
"cmd/internal/objabi": true,
"cmd/internal/objfile": true,
"cmd/internal/src": true,
"cmd/internal/sys": true,
"cmd/internal/test2json": true,
"cmd/link": true,
"cmd/link/internal/amd64": true,
"cmd/link/internal/arm": true,
"cmd/link/internal/arm64": true,
"cmd/link/internal/ld": true,
"cmd/link/internal/loadelf": true,
"cmd/link/internal/loadmacho": true,
"cmd/link/internal/loadpe": true,
"cmd/link/internal/mips": true,
"cmd/link/internal/mips64": true,
"cmd/link/internal/objfile": true,
"cmd/link/internal/ppc64": true,
"cmd/link/internal/s390x": true,
"cmd/link/internal/sym": true,
"cmd/link/internal/x86": true,
"cmd/nm": true,
"cmd/objdump": true,
"cmd/pack": true,
"cmd/pprof": true,
"cmd/test2json": true,
"cmd/trace": true,
"cmd/vet": true,
"cmd/vet/internal/cfg": true,
"cmd/vet/internal/whitelist": true,
"compress/bzip2": true,
"compress/flate": true,
"compress/gzip": true,
"compress/lzw": true,
"compress/zlib": true,
"container/heap": true,
"container/list": true,
"container/ring": true,
"context": true,
"crypto": true,
"crypto/aes": true,
"crypto/cipher": true,
"crypto/des": true,
"crypto/dsa": true,
"crypto/ecdsa": true,
"crypto/elliptic": true,
"crypto/hmac": true,
"crypto/internal/cipherhw": true,
"crypto/md5": true,
"crypto/rand": true,
"crypto/rc4": true,
"crypto/rsa": true,
"crypto/sha1": true,
"crypto/sha256": true,
"crypto/sha512": true,
"crypto/subtle": true,
"crypto/tls": true,
"crypto/x509": true,
"crypto/x509/pkix": true,
"database/sql": true,
"database/sql/driver": true,
"debug/dwarf": true,
"debug/elf": true,
"debug/gosym": true,
"debug/macho": true,
"debug/pe": true,
"debug/plan9obj": true,
"encoding": true,
"encoding/ascii85": true,
"encoding/asn1": true,
"encoding/base32": true,
"encoding/base64": true,
"encoding/binary": true,
"encoding/csv": true,
"encoding/gob": true,
"encoding/hex": true,
"encoding/json": true,
"encoding/pem": true,
"encoding/xml": true,
"errors": true,
"expvar": true,
"flag": true,
"fmt": true,
"go/ast": true,
"go/build": true,
"go/constant": true,
"go/doc": true,
"go/format": true,
"go/importer": true,
"go/internal/gccgoimporter": true,
"go/internal/gcimporter": true,
"go/internal/srcimporter": true,
"go/parser": true,
"go/printer": true,
"go/scanner": true,
"go/token": true,
"go/types": true,
"hash": true,
"hash/adler32": true,
"hash/crc32": true,
"hash/crc64": true,
"hash/fnv": true,
"html": true,
"html/template": true,
"image": true,
"image/color": true,
"image/color/palette": true,
"image/draw": true,
"image/gif": true,
"image/internal/imageutil": true,
"image/jpeg": true,
"image/png": true,
"index/suffixarray": true,
"internal/cpu": true,
"internal/nettrace": true,
"internal/poll": true,
"internal/race": true,
"internal/singleflight": true,
"internal/syscall/windows": true,
"internal/syscall/windows/registry": true,
"internal/syscall/windows/sysdll": true,
"internal/testenv": true,
"internal/testlog": true,
"internal/trace": true,
"io": true,
"io/ioutil": true,
"log": true,
"log/syslog": true,
"math": true,
"math/big": true,
"math/bits": true,
"math/cmplx": true,
"math/rand": true,
"mime": true,
"mime/multipart": true,
"mime/quotedprintable": true,
"net": true,
"net/http": true,
"net/http/cgi": true,
"net/http/cookiejar": true,
"net/http/fcgi": true,
"net/http/httptest": true,
"net/http/httptrace": true,
"net/http/httputil": true,
"net/http/internal": true,
"net/http/pprof": true,
"net/internal/socktest": true,
"net/mail": true,
"net/rpc": true,
"net/rpc/jsonrpc": true,
"net/smtp": true,
"net/textproto": true,
"net/url": true,
"os": true,
"os/exec": true,
"os/signal": true,
"os/signal/internal/pty": true,
"os/user": true,
"path": true,
"path/filepath": true,
"plugin": true,
"reflect": true,
"regexp": true,
"regexp/syntax": true,
"runtime": true,
"runtime/cgo": true,
"runtime/debug": true,
"runtime/internal/atomic": true,
"runtime/internal/sys": true,
"runtime/pprof": true,
"runtime/pprof/internal/profile": true,
"runtime/race": true,
"runtime/trace": true,
"sort": true,
"strconv": true,
"strings": true,
"sync": true,
"sync/atomic": true,
"syscall": true,
"testing": true,
"testing/internal/testdeps": true,
"testing/iotest": true,
"testing/quick": true,
"text/scanner": true,
"text/tabwriter": true,
"text/template": true,
"text/template/parse": true,
"time": true,
"unicode": true,
"unicode/utf16": true,
"unicode/utf8": true,
"unsafe": true,
}

View File

@@ -1,96 +0,0 @@
/* Copyright 2018 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package language
import (
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/resolve"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
)
// Language describes an extension for Gazelle that provides support for
// a set of Bazel rules.
//
// Languages are used primarily by the fix and update commands. The order
// in which languages are used matters, since languages may depend on
// one another. For example, go depends on proto, since go_proto_libraries
// are generated from metadata stored in proto_libraries.
//
// A single instance of Language is created for each fix / update run. Some
// state may be stored in this instance, but stateless behavior is encouraged,
// especially since some operations may be concurrent in the future.
//
// Tasks languages are used for
//
// * Configuration (embedded interface config.Configurer). Languages may
// define command line flags and alter the configuration in a directory
// based on directives in build files.
//
// * Fixing deprecated usage of rules in build files.
//
// * Generating rules from source files in a directory.
//
// * Resolving library imports (embedded interface resolve.Resolver). For
// example, import strings like "github.com/foo/bar" in Go can be resolved
// into Bazel labels like "@com_github_foo_bar//:go_default_library".
//
// Tasks languages support
//
// * Generating load statements: languages list files and symbols that may
// be loaded.
//
// * Merging generated rules into existing rules: languages provide metadata
// that helps with rule matching, merging, and deletion.
type Language interface {
config.Configurer
resolve.Resolver
// Kinds returns a map of maps rule names (kinds) and information on how to
// match and merge attributes that may be found in rules of those kinds. All
// kinds of rules generated for this language may be found here.
Kinds() map[string]rule.KindInfo
// Loads returns .bzl files and symbols they define. Every rule generated by
// GenerateRules, now or in the past, should be loadable from one of these
// files.
Loads() []rule.LoadInfo
// GenerateRules extracts build metadata from source files in a directory.
// GenerateRules is called in each directory where an update is requested
// in depth-first post-order.
//
// c is the configuration for the current directory.
// dir is the absolute path to the directory to scan.
// rel is the relative path to the directory from the repository root.
// f is the build file. It may be nil. It should not be modified.
// subdirs is a list of subdirectory names.
// regularFiles is a list of normal files in the directory.
// genFiles is a list of generated files, found in outputs of rules.
// otherEmpty and otherGen are lists of empty and generated rules created
// by other languages processed before this language.
//
// empty is a list of empty rules that may be deleted after merge.
// gen is a list of generated rules that may be updated or added.
//
// Any non-fatal errors this function encounters should be logged using
// log.Print.
GenerateRules(c *config.Config, dir, rel string, f *rule.File, subdirs, regularFiles, genFiles []string, otherEmpty, otherGen []*rule.Rule) (empty, gen []*rule.Rule)
// Fix repairs deprecated usage of language-specific rules in f. This is
// called before the file is indexed. Unless c.ShouldFix is true, fixes
// that delete or rename rules should not be performed.
Fix(c *config.Config, f *rule.File)
}

View File

@@ -1,42 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"config.go",
"constants.go",
"fileinfo.go",
"fix.go",
"generate.go",
"kinds.go",
"known_imports.go",
"lang.go",
"package.go",
"resolve.go",
],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/internal/language/proto",
importpath = "github.com/bazelbuild/bazel-gazelle/internal/language/proto",
visibility = ["//vendor/github.com/bazelbuild/bazel-gazelle:__subpackages__"],
deps = [
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/config:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/label:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/language:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/repos:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/resolve:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/rule:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -1,366 +0,0 @@
// Generated by internal/language/proto/gen/gen_known_imports.go
// From internal/language/proto/proto.csv
package proto
import "github.com/bazelbuild/bazel-gazelle/internal/label"
var knownImports = map[string]label.Label{
"google/protobuf/any.proto": label.New("com_google_protobuf", "", "any_proto"),
"google/protobuf/api.proto": label.New("com_google_protobuf", "", "api_proto"),
"google/protobuf/compiler/plugin.proto": label.New("com_google_protobuf", "", "compiler_plugin_proto"),
"google/protobuf/descriptor.proto": label.New("com_google_protobuf", "", "descriptor_proto"),
"google/protobuf/duration.proto": label.New("com_google_protobuf", "", "duration_proto"),
"google/protobuf/empty.proto": label.New("com_google_protobuf", "", "empty_proto"),
"google/protobuf/field_mask.proto": label.New("com_google_protobuf", "", "field_mask_proto"),
"google/protobuf/source_context.proto": label.New("com_google_protobuf", "", "source_context_proto"),
"google/protobuf/struct.proto": label.New("com_google_protobuf", "", "struct_proto"),
"google/protobuf/timestamp.proto": label.New("com_google_protobuf", "", "timestamp_proto"),
"google/protobuf/type.proto": label.New("com_google_protobuf", "", "type_proto"),
"google/protobuf/wrappers.proto": label.New("com_google_protobuf", "", "wrappers_proto"),
"google/api/annotations.proto": label.New("go_googleapis", "google/api", "annotations_proto"),
"google/api/auth.proto": label.New("go_googleapis", "google/api", "serviceconfig_proto"),
"google/api/backend.proto": label.New("go_googleapis", "google/api", "serviceconfig_proto"),
"google/api/billing.proto": label.New("go_googleapis", "google/api", "serviceconfig_proto"),
"google/api/config_change.proto": label.New("go_googleapis", "google/api", "configchange_proto"),
"google/api/consumer.proto": label.New("go_googleapis", "google/api", "serviceconfig_proto"),
"google/api/context.proto": label.New("go_googleapis", "google/api", "serviceconfig_proto"),
"google/api/control.proto": label.New("go_googleapis", "google/api", "serviceconfig_proto"),
"google/api/distribution.proto": label.New("go_googleapis", "google/api", "distribution_proto"),
"google/api/documentation.proto": label.New("go_googleapis", "google/api", "serviceconfig_proto"),
"google/api/endpoint.proto": label.New("go_googleapis", "google/api", "serviceconfig_proto"),
"google/api/experimental/authorization_config.proto": label.New("go_googleapis", "google/api", "api_proto"),
"google/api/experimental/experimental.proto": label.New("go_googleapis", "google/api", "api_proto"),
"google/api/expr/v1alpha1/cel_service.proto": label.New("go_googleapis", "google/api/expr/v1alpha1", "expr_proto"),
"google/api/expr/v1alpha1/checked.proto": label.New("go_googleapis", "google/api/expr/v1alpha1", "expr_proto"),
"google/api/expr/v1alpha1/eval.proto": label.New("go_googleapis", "google/api/expr/v1alpha1", "expr_proto"),
"google/api/expr/v1alpha1/explain.proto": label.New("go_googleapis", "google/api/expr/v1alpha1", "expr_proto"),
"google/api/expr/v1alpha1/syntax.proto": label.New("go_googleapis", "google/api/expr/v1alpha1", "expr_proto"),
"google/api/expr/v1alpha1/value.proto": label.New("go_googleapis", "google/api/expr/v1alpha1", "expr_proto"),
"google/api/expr/v1beta1/decl.proto": label.New("go_googleapis", "google/api/expr/v1beta1", "expr_proto"),
"google/api/expr/v1beta1/eval.proto": label.New("go_googleapis", "google/api/expr/v1beta1", "expr_proto"),
"google/api/expr/v1beta1/expr.proto": label.New("go_googleapis", "google/api/expr/v1beta1", "expr_proto"),
"google/api/expr/v1beta1/source.proto": label.New("go_googleapis", "google/api/expr/v1beta1", "expr_proto"),
"google/api/expr/v1beta1/value.proto": label.New("go_googleapis", "google/api/expr/v1beta1", "expr_proto"),
"google/api/http.proto": label.New("go_googleapis", "google/api", "annotations_proto"),
"google/api/httpbody.proto": label.New("go_googleapis", "google/api", "httpbody_proto"),
"google/api/label.proto": label.New("go_googleapis", "google/api", "label_proto"),
"google/api/launch_stage.proto": label.New("go_googleapis", "google/api", "api_proto"),
"google/api/log.proto": label.New("go_googleapis", "google/api", "serviceconfig_proto"),
"google/api/logging.proto": label.New("go_googleapis", "google/api", "serviceconfig_proto"),
"google/api/metric.proto": label.New("go_googleapis", "google/api", "metric_proto"),
"google/api/monitored_resource.proto": label.New("go_googleapis", "google/api", "monitoredres_proto"),
"google/api/monitoring.proto": label.New("go_googleapis", "google/api", "serviceconfig_proto"),
"google/api/quota.proto": label.New("go_googleapis", "google/api", "serviceconfig_proto"),
"google/api/service.proto": label.New("go_googleapis", "google/api", "serviceconfig_proto"),
"google/api/servicecontrol/v1/check_error.proto": label.New("go_googleapis", "google/api/servicecontrol/v1", "servicecontrol_proto"),
"google/api/servicecontrol/v1/distribution.proto": label.New("go_googleapis", "google/api/servicecontrol/v1", "servicecontrol_proto"),
"google/api/servicecontrol/v1/log_entry.proto": label.New("go_googleapis", "google/api/servicecontrol/v1", "servicecontrol_proto"),
"google/api/servicecontrol/v1/metric_value.proto": label.New("go_googleapis", "google/api/servicecontrol/v1", "servicecontrol_proto"),
"google/api/servicecontrol/v1/operation.proto": label.New("go_googleapis", "google/api/servicecontrol/v1", "servicecontrol_proto"),
"google/api/servicecontrol/v1/quota_controller.proto": label.New("go_googleapis", "google/api/servicecontrol/v1", "servicecontrol_proto"),
"google/api/servicecontrol/v1/service_controller.proto": label.New("go_googleapis", "google/api/servicecontrol/v1", "servicecontrol_proto"),
"google/api/servicemanagement/v1/resources.proto": label.New("go_googleapis", "google/api/servicemanagement/v1", "servicemanagement_proto"),
"google/api/servicemanagement/v1/servicemanager.proto": label.New("go_googleapis", "google/api/servicemanagement/v1", "servicemanagement_proto"),
"google/api/source_info.proto": label.New("go_googleapis", "google/api", "serviceconfig_proto"),
"google/api/system_parameter.proto": label.New("go_googleapis", "google/api", "serviceconfig_proto"),
"google/api/usage.proto": label.New("go_googleapis", "google/api", "serviceconfig_proto"),
"google/appengine/legacy/audit_data.proto": label.New("go_googleapis", "google/appengine/legacy", "legacy_proto"),
"google/appengine/logging/v1/request_log.proto": label.New("go_googleapis", "google/appengine/logging/v1", "logging_proto"),
"google/appengine/v1/app_yaml.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_proto"),
"google/appengine/v1/appengine.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_proto"),
"google/appengine/v1/application.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_proto"),
"google/appengine/v1/audit_data.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_proto"),
"google/appengine/v1/deploy.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_proto"),
"google/appengine/v1/instance.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_proto"),
"google/appengine/v1/location.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_proto"),
"google/appengine/v1/operation.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_proto"),
"google/appengine/v1/service.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_proto"),
"google/appengine/v1/version.proto": label.New("go_googleapis", "google/appengine/v1", "appengine_proto"),
"google/assistant/embedded/v1alpha1/embedded_assistant.proto": label.New("go_googleapis", "google/assistant/embedded/v1alpha1", "embedded_proto"),
"google/assistant/embedded/v1alpha2/embedded_assistant.proto": label.New("go_googleapis", "google/assistant/embedded/v1alpha2", "embedded_proto"),
"google/bigtable/admin/cluster/v1/bigtable_cluster_data.proto": label.New("go_googleapis", "google/bigtable/admin/cluster/v1", "cluster_proto"),
"google/bigtable/admin/cluster/v1/bigtable_cluster_service.proto": label.New("go_googleapis", "google/bigtable/admin/cluster/v1", "cluster_proto"),
"google/bigtable/admin/cluster/v1/bigtable_cluster_service_messages.proto": label.New("go_googleapis", "google/bigtable/admin/cluster/v1", "cluster_proto"),
"google/bigtable/admin/table/v1/bigtable_table_data.proto": label.New("go_googleapis", "google/bigtable/admin/table/v1", "table_proto"),
"google/bigtable/admin/table/v1/bigtable_table_service.proto": label.New("go_googleapis", "google/bigtable/admin/table/v1", "table_proto"),
"google/bigtable/admin/table/v1/bigtable_table_service_messages.proto": label.New("go_googleapis", "google/bigtable/admin/table/v1", "table_proto"),
"google/bigtable/admin/v2/bigtable_instance_admin.proto": label.New("go_googleapis", "google/bigtable/admin/v2", "admin_proto"),
"google/bigtable/admin/v2/bigtable_table_admin.proto": label.New("go_googleapis", "google/bigtable/admin/v2", "admin_proto"),
"google/bigtable/admin/v2/common.proto": label.New("go_googleapis", "google/bigtable/admin/v2", "admin_proto"),
"google/bigtable/admin/v2/instance.proto": label.New("go_googleapis", "google/bigtable/admin/v2", "admin_proto"),
"google/bigtable/admin/v2/table.proto": label.New("go_googleapis", "google/bigtable/admin/v2", "admin_proto"),
"google/bigtable/v1/bigtable_data.proto": label.New("go_googleapis", "google/bigtable/v1", "bigtable_proto"),
"google/bigtable/v1/bigtable_service.proto": label.New("go_googleapis", "google/bigtable/v1", "bigtable_proto"),
"google/bigtable/v1/bigtable_service_messages.proto": label.New("go_googleapis", "google/bigtable/v1", "bigtable_proto"),
"google/bigtable/v2/bigtable.proto": label.New("go_googleapis", "google/bigtable/v2", "bigtable_proto"),
"google/bigtable/v2/data.proto": label.New("go_googleapis", "google/bigtable/v2", "bigtable_proto"),
"google/bytestream/bytestream.proto": label.New("go_googleapis", "google/bytestream", "bytestream_proto"),
"google/cloud/asset/v1beta1/asset_service.proto": label.New("go_googleapis", "google/cloud/asset/v1beta1", "asset_proto"),
"google/cloud/asset/v1beta1/assets.proto": label.New("go_googleapis", "google/cloud/asset/v1beta1", "asset_proto"),
"google/cloud/audit/audit_log.proto": label.New("go_googleapis", "google/cloud/audit", "audit_proto"),
"google/cloud/automl/v1beta1/annotation_payload.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_proto"),
"google/cloud/automl/v1beta1/classification.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_proto"),
"google/cloud/automl/v1beta1/data_items.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_proto"),
"google/cloud/automl/v1beta1/dataset.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_proto"),
"google/cloud/automl/v1beta1/image.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_proto"),
"google/cloud/automl/v1beta1/io.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_proto"),
"google/cloud/automl/v1beta1/model.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_proto"),
"google/cloud/automl/v1beta1/model_evaluation.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_proto"),
"google/cloud/automl/v1beta1/operations.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_proto"),
"google/cloud/automl/v1beta1/prediction_service.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_proto"),
"google/cloud/automl/v1beta1/service.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_proto"),
"google/cloud/automl/v1beta1/text.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_proto"),
"google/cloud/automl/v1beta1/translation.proto": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_proto"),
"google/cloud/bigquery/datatransfer/v1/datatransfer.proto": label.New("go_googleapis", "google/cloud/bigquery/datatransfer/v1", "datatransfer_proto"),
"google/cloud/bigquery/datatransfer/v1/transfer.proto": label.New("go_googleapis", "google/cloud/bigquery/datatransfer/v1", "datatransfer_proto"),
"google/cloud/bigquery/logging/v1/audit_data.proto": label.New("go_googleapis", "google/cloud/bigquery/logging/v1", "logging_proto"),
"google/cloud/bigquery/storage/v1beta1/avro.proto": label.New("go_googleapis", "google/cloud/bigquery/storage/v1beta1", "storage_proto"),
"google/cloud/bigquery/storage/v1beta1/read_options.proto": label.New("go_googleapis", "google/cloud/bigquery/storage/v1beta1", "storage_proto"),
"google/cloud/bigquery/storage/v1beta1/storage.proto": label.New("go_googleapis", "google/cloud/bigquery/storage/v1beta1", "storage_proto"),
"google/cloud/bigquery/storage/v1beta1/table_reference.proto": label.New("go_googleapis", "google/cloud/bigquery/storage/v1beta1", "storage_proto"),
"google/cloud/billing/v1/cloud_billing.proto": label.New("go_googleapis", "google/cloud/billing/v1", "billing_proto"),
"google/cloud/dataproc/v1/clusters.proto": label.New("go_googleapis", "google/cloud/dataproc/v1", "dataproc_proto"),
"google/cloud/dataproc/v1/jobs.proto": label.New("go_googleapis", "google/cloud/dataproc/v1", "dataproc_proto"),
"google/cloud/dataproc/v1/operations.proto": label.New("go_googleapis", "google/cloud/dataproc/v1", "dataproc_proto"),
"google/cloud/dataproc/v1beta2/clusters.proto": label.New("go_googleapis", "google/cloud/dataproc/v1beta2", "dataproc_proto"),
"google/cloud/dataproc/v1beta2/jobs.proto": label.New("go_googleapis", "google/cloud/dataproc/v1beta2", "dataproc_proto"),
"google/cloud/dataproc/v1beta2/operations.proto": label.New("go_googleapis", "google/cloud/dataproc/v1beta2", "dataproc_proto"),
"google/cloud/dataproc/v1beta2/shared.proto": label.New("go_googleapis", "google/cloud/dataproc/v1beta2", "dataproc_proto"),
"google/cloud/dataproc/v1beta2/workflow_templates.proto": label.New("go_googleapis", "google/cloud/dataproc/v1beta2", "dataproc_proto"),
"google/cloud/dialogflow/v2/agent.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2", "dialogflow_proto"),
"google/cloud/dialogflow/v2/context.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2", "dialogflow_proto"),
"google/cloud/dialogflow/v2/entity_type.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2", "dialogflow_proto"),
"google/cloud/dialogflow/v2/intent.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2", "dialogflow_proto"),
"google/cloud/dialogflow/v2/session.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2", "dialogflow_proto"),
"google/cloud/dialogflow/v2/session_entity_type.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2", "dialogflow_proto"),
"google/cloud/dialogflow/v2/webhook.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2", "dialogflow_proto"),
"google/cloud/dialogflow/v2beta1/agent.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_proto"),
"google/cloud/dialogflow/v2beta1/audio_config.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_proto"),
"google/cloud/dialogflow/v2beta1/context.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_proto"),
"google/cloud/dialogflow/v2beta1/document.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_proto"),
"google/cloud/dialogflow/v2beta1/entity_type.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_proto"),
"google/cloud/dialogflow/v2beta1/intent.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_proto"),
"google/cloud/dialogflow/v2beta1/knowledge_base.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_proto"),
"google/cloud/dialogflow/v2beta1/session.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_proto"),
"google/cloud/dialogflow/v2beta1/session_entity_type.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_proto"),
"google/cloud/dialogflow/v2beta1/webhook.proto": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_proto"),
"google/cloud/functions/v1beta2/functions.proto": label.New("go_googleapis", "google/cloud/functions/v1beta2", "functions_proto"),
"google/cloud/functions/v1beta2/operations.proto": label.New("go_googleapis", "google/cloud/functions/v1beta2", "functions_proto"),
"google/cloud/iot/v1/device_manager.proto": label.New("go_googleapis", "google/cloud/iot/v1", "iot_proto"),
"google/cloud/iot/v1/resources.proto": label.New("go_googleapis", "google/cloud/iot/v1", "iot_proto"),
"google/cloud/kms/v1/resources.proto": label.New("go_googleapis", "google/cloud/kms/v1", "kms_proto"),
"google/cloud/kms/v1/service.proto": label.New("go_googleapis", "google/cloud/kms/v1", "kms_proto"),
"google/cloud/language/v1/language_service.proto": label.New("go_googleapis", "google/cloud/language/v1", "language_proto"),
"google/cloud/language/v1beta1/language_service.proto": label.New("go_googleapis", "google/cloud/language/v1beta1", "language_proto"),
"google/cloud/language/v1beta2/language_service.proto": label.New("go_googleapis", "google/cloud/language/v1beta2", "language_proto"),
"google/cloud/location/locations.proto": label.New("go_googleapis", "google/cloud/location", "location_proto"),
"google/cloud/ml/v1/job_service.proto": label.New("go_googleapis", "google/cloud/ml/v1", "ml_proto"),
"google/cloud/ml/v1/model_service.proto": label.New("go_googleapis", "google/cloud/ml/v1", "ml_proto"),
"google/cloud/ml/v1/operation_metadata.proto": label.New("go_googleapis", "google/cloud/ml/v1", "ml_proto"),
"google/cloud/ml/v1/prediction_service.proto": label.New("go_googleapis", "google/cloud/ml/v1", "ml_proto"),
"google/cloud/ml/v1/project_service.proto": label.New("go_googleapis", "google/cloud/ml/v1", "ml_proto"),
"google/cloud/oslogin/common/common.proto": label.New("go_googleapis", "google/cloud/oslogin/common", "common_proto"),
"google/cloud/oslogin/v1/oslogin.proto": label.New("go_googleapis", "google/cloud/oslogin/v1", "oslogin_proto"),
"google/cloud/oslogin/v1alpha/oslogin.proto": label.New("go_googleapis", "google/cloud/oslogin/v1alpha", "oslogin_proto"),
"google/cloud/oslogin/v1beta/oslogin.proto": label.New("go_googleapis", "google/cloud/oslogin/v1beta", "oslogin_proto"),
"google/cloud/redis/v1/cloud_redis.proto": label.New("go_googleapis", "google/cloud/redis/v1", "redis_proto"),
"google/cloud/redis/v1beta1/cloud_redis.proto": label.New("go_googleapis", "google/cloud/redis/v1beta1", "redis_proto"),
"google/cloud/resourcemanager/v2/folders.proto": label.New("go_googleapis", "google/cloud/resourcemanager/v2", "resourcemanager_proto"),
"google/cloud/runtimeconfig/v1beta1/resources.proto": label.New("go_googleapis", "google/cloud/runtimeconfig/v1beta1", "runtimeconfig_proto"),
"google/cloud/runtimeconfig/v1beta1/runtimeconfig.proto": label.New("go_googleapis", "google/cloud/runtimeconfig/v1beta1", "runtimeconfig_proto"),
"google/cloud/speech/v1/cloud_speech.proto": label.New("go_googleapis", "google/cloud/speech/v1", "speech_proto"),
"google/cloud/speech/v1p1beta1/cloud_speech.proto": label.New("go_googleapis", "google/cloud/speech/v1p1beta1", "speech_proto"),
"google/cloud/support/common.proto": label.New("go_googleapis", "google/cloud/support", "common_proto"),
"google/cloud/support/v1alpha1/cloud_support.proto": label.New("go_googleapis", "google/cloud/support/v1alpha1", "support_proto"),
"google/cloud/tasks/v2beta2/cloudtasks.proto": label.New("go_googleapis", "google/cloud/tasks/v2beta2", "tasks_proto"),
"google/cloud/tasks/v2beta2/queue.proto": label.New("go_googleapis", "google/cloud/tasks/v2beta2", "tasks_proto"),
"google/cloud/tasks/v2beta2/target.proto": label.New("go_googleapis", "google/cloud/tasks/v2beta2", "tasks_proto"),
"google/cloud/tasks/v2beta2/task.proto": label.New("go_googleapis", "google/cloud/tasks/v2beta2", "tasks_proto"),
"google/cloud/tasks/v2beta3/cloudtasks.proto": label.New("go_googleapis", "google/cloud/tasks/v2beta3", "tasks_proto"),
"google/cloud/tasks/v2beta3/queue.proto": label.New("go_googleapis", "google/cloud/tasks/v2beta3", "tasks_proto"),
"google/cloud/tasks/v2beta3/target.proto": label.New("go_googleapis", "google/cloud/tasks/v2beta3", "tasks_proto"),
"google/cloud/tasks/v2beta3/task.proto": label.New("go_googleapis", "google/cloud/tasks/v2beta3", "tasks_proto"),
"google/cloud/texttospeech/v1/cloud_tts.proto": label.New("go_googleapis", "google/cloud/texttospeech/v1", "texttospeech_proto"),
"google/cloud/texttospeech/v1beta1/cloud_tts.proto": label.New("go_googleapis", "google/cloud/texttospeech/v1beta1", "texttospeech_proto"),
"google/cloud/videointelligence/v1/video_intelligence.proto": label.New("go_googleapis", "google/cloud/videointelligence/v1", "videointelligence_proto"),
"google/cloud/videointelligence/v1beta1/video_intelligence.proto": label.New("go_googleapis", "google/cloud/videointelligence/v1beta1", "videointelligence_proto"),
"google/cloud/videointelligence/v1beta2/video_intelligence.proto": label.New("go_googleapis", "google/cloud/videointelligence/v1beta2", "videointelligence_proto"),
"google/cloud/videointelligence/v1p1beta1/video_intelligence.proto": label.New("go_googleapis", "google/cloud/videointelligence/v1p1beta1", "videointelligence_proto"),
"google/cloud/videointelligence/v1p2beta1/video_intelligence.proto": label.New("go_googleapis", "google/cloud/videointelligence/v1p2beta1", "videointelligence_proto"),
"google/cloud/vision/v1/geometry.proto": label.New("go_googleapis", "google/cloud/vision/v1", "vision_proto"),
"google/cloud/vision/v1/image_annotator.proto": label.New("go_googleapis", "google/cloud/vision/v1", "vision_proto"),
"google/cloud/vision/v1/text_annotation.proto": label.New("go_googleapis", "google/cloud/vision/v1", "vision_proto"),
"google/cloud/vision/v1/web_detection.proto": label.New("go_googleapis", "google/cloud/vision/v1", "vision_proto"),
"google/cloud/vision/v1p1beta1/geometry.proto": label.New("go_googleapis", "google/cloud/vision/v1p1beta1", "vision_proto"),
"google/cloud/vision/v1p1beta1/image_annotator.proto": label.New("go_googleapis", "google/cloud/vision/v1p1beta1", "vision_proto"),
"google/cloud/vision/v1p1beta1/text_annotation.proto": label.New("go_googleapis", "google/cloud/vision/v1p1beta1", "vision_proto"),
"google/cloud/vision/v1p1beta1/web_detection.proto": label.New("go_googleapis", "google/cloud/vision/v1p1beta1", "vision_proto"),
"google/cloud/vision/v1p2beta1/geometry.proto": label.New("go_googleapis", "google/cloud/vision/v1p2beta1", "vision_proto"),
"google/cloud/vision/v1p2beta1/image_annotator.proto": label.New("go_googleapis", "google/cloud/vision/v1p2beta1", "vision_proto"),
"google/cloud/vision/v1p2beta1/text_annotation.proto": label.New("go_googleapis", "google/cloud/vision/v1p2beta1", "vision_proto"),
"google/cloud/vision/v1p2beta1/web_detection.proto": label.New("go_googleapis", "google/cloud/vision/v1p2beta1", "vision_proto"),
"google/cloud/vision/v1p3beta1/geometry.proto": label.New("go_googleapis", "google/cloud/vision/v1p3beta1", "vision_proto"),
"google/cloud/vision/v1p3beta1/image_annotator.proto": label.New("go_googleapis", "google/cloud/vision/v1p3beta1", "vision_proto"),
"google/cloud/vision/v1p3beta1/product_search.proto": label.New("go_googleapis", "google/cloud/vision/v1p3beta1", "vision_proto"),
"google/cloud/vision/v1p3beta1/product_search_service.proto": label.New("go_googleapis", "google/cloud/vision/v1p3beta1", "vision_proto"),
"google/cloud/vision/v1p3beta1/text_annotation.proto": label.New("go_googleapis", "google/cloud/vision/v1p3beta1", "vision_proto"),
"google/cloud/vision/v1p3beta1/web_detection.proto": label.New("go_googleapis", "google/cloud/vision/v1p3beta1", "vision_proto"),
"google/cloud/websecurityscanner/v1alpha/crawled_url.proto": label.New("go_googleapis", "google/cloud/websecurityscanner/v1alpha", "websecurityscanner_proto"),
"google/cloud/websecurityscanner/v1alpha/finding.proto": label.New("go_googleapis", "google/cloud/websecurityscanner/v1alpha", "websecurityscanner_proto"),
"google/cloud/websecurityscanner/v1alpha/finding_addon.proto": label.New("go_googleapis", "google/cloud/websecurityscanner/v1alpha", "websecurityscanner_proto"),
"google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto": label.New("go_googleapis", "google/cloud/websecurityscanner/v1alpha", "websecurityscanner_proto"),
"google/cloud/websecurityscanner/v1alpha/scan_config.proto": label.New("go_googleapis", "google/cloud/websecurityscanner/v1alpha", "websecurityscanner_proto"),
"google/cloud/websecurityscanner/v1alpha/scan_run.proto": label.New("go_googleapis", "google/cloud/websecurityscanner/v1alpha", "websecurityscanner_proto"),
"google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto": label.New("go_googleapis", "google/cloud/websecurityscanner/v1alpha", "websecurityscanner_proto"),
"google/container/v1/cluster_service.proto": label.New("go_googleapis", "google/container/v1", "container_proto"),
"google/container/v1alpha1/cluster_service.proto": label.New("go_googleapis", "google/container/v1alpha1", "container_proto"),
"google/container/v1beta1/cluster_service.proto": label.New("go_googleapis", "google/container/v1beta1", "container_proto"),
"google/datastore/admin/v1/datastore_admin.proto": label.New("go_googleapis", "google/datastore/admin/v1", "admin_proto"),
"google/datastore/admin/v1/index.proto": label.New("go_googleapis", "google/datastore/admin/v1", "admin_proto"),
"google/datastore/admin/v1beta1/datastore_admin.proto": label.New("go_googleapis", "google/datastore/admin/v1beta1", "admin_proto"),
"google/datastore/v1/datastore.proto": label.New("go_googleapis", "google/datastore/v1", "datastore_proto"),
"google/datastore/v1/entity.proto": label.New("go_googleapis", "google/datastore/v1", "datastore_proto"),
"google/datastore/v1/query.proto": label.New("go_googleapis", "google/datastore/v1", "datastore_proto"),
"google/datastore/v1beta3/datastore.proto": label.New("go_googleapis", "google/datastore/v1beta3", "datastore_proto"),
"google/datastore/v1beta3/entity.proto": label.New("go_googleapis", "google/datastore/v1beta3", "datastore_proto"),
"google/datastore/v1beta3/query.proto": label.New("go_googleapis", "google/datastore/v1beta3", "datastore_proto"),
"google/devtools/build/v1/build_events.proto": label.New("go_googleapis", "google/devtools/build/v1", "build_proto"),
"google/devtools/build/v1/build_status.proto": label.New("go_googleapis", "google/devtools/build/v1", "build_proto"),
"google/devtools/build/v1/publish_build_event.proto": label.New("go_googleapis", "google/devtools/build/v1", "build_proto"),
"google/devtools/cloudbuild/v1/cloudbuild.proto": label.New("go_googleapis", "google/devtools/cloudbuild/v1", "cloudbuild_proto"),
"google/devtools/clouddebugger/v2/controller.proto": label.New("go_googleapis", "google/devtools/clouddebugger/v2", "clouddebugger_proto"),
"google/devtools/clouddebugger/v2/data.proto": label.New("go_googleapis", "google/devtools/clouddebugger/v2", "clouddebugger_proto"),
"google/devtools/clouddebugger/v2/debugger.proto": label.New("go_googleapis", "google/devtools/clouddebugger/v2", "clouddebugger_proto"),
"google/devtools/clouderrorreporting/v1beta1/common.proto": label.New("go_googleapis", "google/devtools/clouderrorreporting/v1beta1", "clouderrorreporting_proto"),
"google/devtools/clouderrorreporting/v1beta1/error_group_service.proto": label.New("go_googleapis", "google/devtools/clouderrorreporting/v1beta1", "clouderrorreporting_proto"),
"google/devtools/clouderrorreporting/v1beta1/error_stats_service.proto": label.New("go_googleapis", "google/devtools/clouderrorreporting/v1beta1", "clouderrorreporting_proto"),
"google/devtools/clouderrorreporting/v1beta1/report_errors_service.proto": label.New("go_googleapis", "google/devtools/clouderrorreporting/v1beta1", "clouderrorreporting_proto"),
"google/devtools/cloudprofiler/v2/profiler.proto": label.New("go_googleapis", "google/devtools/cloudprofiler/v2", "cloudprofiler_proto"),
"google/devtools/cloudtrace/v1/trace.proto": label.New("go_googleapis", "google/devtools/cloudtrace/v1", "cloudtrace_proto"),
"google/devtools/cloudtrace/v2/trace.proto": label.New("go_googleapis", "google/devtools/cloudtrace/v2", "cloudtrace_proto"),
"google/devtools/cloudtrace/v2/tracing.proto": label.New("go_googleapis", "google/devtools/cloudtrace/v2", "cloudtrace_proto"),
"google/devtools/containeranalysis/v1alpha1/bill_of_materials.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1alpha1", "containeranalysis_proto"),
"google/devtools/containeranalysis/v1alpha1/containeranalysis.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1alpha1", "containeranalysis_proto"),
"google/devtools/containeranalysis/v1alpha1/image_basis.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1alpha1", "containeranalysis_proto"),
"google/devtools/containeranalysis/v1alpha1/package_vulnerability.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1alpha1", "containeranalysis_proto"),
"google/devtools/containeranalysis/v1alpha1/provenance.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1alpha1", "containeranalysis_proto"),
"google/devtools/containeranalysis/v1alpha1/source_context.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1alpha1", "containeranalysis_proto"),
"google/devtools/containeranalysis/v1beta1/attestation/attestation.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/attestation", "attestation_proto"),
"google/devtools/containeranalysis/v1beta1/build/build.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/build", "build_proto"),
"google/devtools/containeranalysis/v1beta1/common/common.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/common", "common_proto"),
"google/devtools/containeranalysis/v1beta1/containeranalysis.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1", "containeranalysis_proto"),
"google/devtools/containeranalysis/v1beta1/deployment/deployment.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/deployment", "deployment_proto"),
"google/devtools/containeranalysis/v1beta1/discovery/discovery.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/discovery", "discovery_proto"),
"google/devtools/containeranalysis/v1beta1/grafeas/grafeas.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/grafeas", "grafeas_proto"),
"google/devtools/containeranalysis/v1beta1/image/image.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/image", "image_proto"),
"google/devtools/containeranalysis/v1beta1/package/package.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/package", "package_proto"),
"google/devtools/containeranalysis/v1beta1/provenance/provenance.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/provenance", "provenance_proto"),
"google/devtools/containeranalysis/v1beta1/source/source.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/source", "source_proto"),
"google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/vulnerability", "vulnerability_proto"),
"google/devtools/remoteexecution/v1test/remote_execution.proto": label.New("go_googleapis", "google/devtools/remoteexecution/v1test", "remoteexecution_proto"),
"google/devtools/remoteworkers/v1test2/bots.proto": label.New("go_googleapis", "google/devtools/remoteworkers/v1test2", "remoteworkers_proto"),
"google/devtools/remoteworkers/v1test2/command.proto": label.New("go_googleapis", "google/devtools/remoteworkers/v1test2", "remoteworkers_proto"),
"google/devtools/remoteworkers/v1test2/tasks.proto": label.New("go_googleapis", "google/devtools/remoteworkers/v1test2", "remoteworkers_proto"),
"google/devtools/remoteworkers/v1test2/worker.proto": label.New("go_googleapis", "google/devtools/remoteworkers/v1test2", "remoteworkers_proto"),
"google/devtools/resultstore/v2/action.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_proto"),
"google/devtools/resultstore/v2/common.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_proto"),
"google/devtools/resultstore/v2/configuration.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_proto"),
"google/devtools/resultstore/v2/configured_target.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_proto"),
"google/devtools/resultstore/v2/coverage.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_proto"),
"google/devtools/resultstore/v2/coverage_summary.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_proto"),
"google/devtools/resultstore/v2/file.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_proto"),
"google/devtools/resultstore/v2/file_set.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_proto"),
"google/devtools/resultstore/v2/invocation.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_proto"),
"google/devtools/resultstore/v2/resultstore_download.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_proto"),
"google/devtools/resultstore/v2/resultstore_file_download.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_proto"),
"google/devtools/resultstore/v2/target.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_proto"),
"google/devtools/resultstore/v2/test_suite.proto": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_proto"),
"google/devtools/source/v1/source_context.proto": label.New("go_googleapis", "google/devtools/source/v1", "source_proto"),
"google/devtools/sourcerepo/v1/sourcerepo.proto": label.New("go_googleapis", "google/devtools/sourcerepo/v1", "sourcerepo_proto"),
"google/example/library/v1/library.proto": label.New("go_googleapis", "google/example/library/v1", "library_proto"),
"google/firestore/admin/v1beta1/firestore_admin.proto": label.New("go_googleapis", "google/firestore/admin/v1beta1", "admin_proto"),
"google/firestore/admin/v1beta1/index.proto": label.New("go_googleapis", "google/firestore/admin/v1beta1", "admin_proto"),
"google/firestore/admin/v1beta2/field.proto": label.New("go_googleapis", "google/firestore/admin/v1beta2", "admin_proto"),
"google/firestore/admin/v1beta2/firestore_admin.proto": label.New("go_googleapis", "google/firestore/admin/v1beta2", "admin_proto"),
"google/firestore/admin/v1beta2/index.proto": label.New("go_googleapis", "google/firestore/admin/v1beta2", "admin_proto"),
"google/firestore/admin/v1beta2/operation.proto": label.New("go_googleapis", "google/firestore/admin/v1beta2", "admin_proto"),
"google/firestore/v1beta1/common.proto": label.New("go_googleapis", "google/firestore/v1beta1", "firestore_proto"),
"google/firestore/v1beta1/document.proto": label.New("go_googleapis", "google/firestore/v1beta1", "firestore_proto"),
"google/firestore/v1beta1/firestore.proto": label.New("go_googleapis", "google/firestore/v1beta1", "firestore_proto"),
"google/firestore/v1beta1/query.proto": label.New("go_googleapis", "google/firestore/v1beta1", "firestore_proto"),
"google/firestore/v1beta1/write.proto": label.New("go_googleapis", "google/firestore/v1beta1", "firestore_proto"),
"google/genomics/v1/annotations.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_proto"),
"google/genomics/v1/cigar.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_proto"),
"google/genomics/v1/datasets.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_proto"),
"google/genomics/v1/operations.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_proto"),
"google/genomics/v1/position.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_proto"),
"google/genomics/v1/range.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_proto"),
"google/genomics/v1/readalignment.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_proto"),
"google/genomics/v1/readgroup.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_proto"),
"google/genomics/v1/readgroupset.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_proto"),
"google/genomics/v1/reads.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_proto"),
"google/genomics/v1/references.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_proto"),
"google/genomics/v1/variants.proto": label.New("go_googleapis", "google/genomics/v1", "genomics_proto"),
"google/genomics/v1alpha2/pipelines.proto": label.New("go_googleapis", "google/genomics/v1alpha2", "genomics_proto"),
"google/home/graph/v1/device.proto": label.New("go_googleapis", "google/home/graph/v1", "graph_proto"),
"google/home/graph/v1/homegraph.proto": label.New("go_googleapis", "google/home/graph/v1", "graph_proto"),
"google/iam/admin/v1/iam.proto": label.New("go_googleapis", "google/iam/admin/v1", "admin_proto"),
"google/iam/credentials/v1/common.proto": label.New("go_googleapis", "google/iam/credentials/v1", "credentials_proto"),
"google/iam/credentials/v1/iamcredentials.proto": label.New("go_googleapis", "google/iam/credentials/v1", "credentials_proto"),
"google/iam/v1/iam_policy.proto": label.New("go_googleapis", "google/iam/v1", "iam_proto"),
"google/iam/v1/logging/audit_data.proto": label.New("go_googleapis", "google/iam/v1/logging", "logging_proto"),
"google/iam/v1/policy.proto": label.New("go_googleapis", "google/iam/v1", "iam_proto"),
"google/logging/type/http_request.proto": label.New("go_googleapis", "google/logging/type", "ltype_proto"),
"google/logging/type/log_severity.proto": label.New("go_googleapis", "google/logging/type", "ltype_proto"),
"google/logging/v2/log_entry.proto": label.New("go_googleapis", "google/logging/v2", "logging_proto"),
"google/logging/v2/logging.proto": label.New("go_googleapis", "google/logging/v2", "logging_proto"),
"google/logging/v2/logging_config.proto": label.New("go_googleapis", "google/logging/v2", "logging_proto"),
"google/logging/v2/logging_metrics.proto": label.New("go_googleapis", "google/logging/v2", "logging_proto"),
"google/longrunning/operations.proto": label.New("go_googleapis", "google/longrunning", "longrunning_proto"),
"google/monitoring/v3/alert.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_proto"),
"google/monitoring/v3/alert_service.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_proto"),
"google/monitoring/v3/common.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_proto"),
"google/monitoring/v3/dropped_labels.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_proto"),
"google/monitoring/v3/group.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_proto"),
"google/monitoring/v3/group_service.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_proto"),
"google/monitoring/v3/metric.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_proto"),
"google/monitoring/v3/metric_service.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_proto"),
"google/monitoring/v3/mutation_record.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_proto"),
"google/monitoring/v3/notification.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_proto"),
"google/monitoring/v3/notification_service.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_proto"),
"google/monitoring/v3/span_context.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_proto"),
"google/monitoring/v3/uptime.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_proto"),
"google/monitoring/v3/uptime_service.proto": label.New("go_googleapis", "google/monitoring/v3", "monitoring_proto"),
"google/privacy/dlp/v2/dlp.proto": label.New("go_googleapis", "google/privacy/dlp/v2", "dlp_proto"),
"google/privacy/dlp/v2/storage.proto": label.New("go_googleapis", "google/privacy/dlp/v2", "dlp_proto"),
"google/pubsub/v1/pubsub.proto": label.New("go_googleapis", "google/pubsub/v1", "pubsub_proto"),
"google/pubsub/v1beta2/pubsub.proto": label.New("go_googleapis", "google/pubsub/v1beta2", "pubsub_proto"),
"google/rpc/code.proto": label.New("go_googleapis", "google/rpc", "code_proto"),
"google/rpc/error_details.proto": label.New("go_googleapis", "google/rpc", "errdetails_proto"),
"google/rpc/status.proto": label.New("go_googleapis", "google/rpc", "status_proto"),
"google/spanner/admin/database/v1/spanner_database_admin.proto": label.New("go_googleapis", "google/spanner/admin/database/v1", "database_proto"),
"google/spanner/admin/instance/v1/spanner_instance_admin.proto": label.New("go_googleapis", "google/spanner/admin/instance/v1", "instance_proto"),
"google/spanner/v1/keys.proto": label.New("go_googleapis", "google/spanner/v1", "spanner_proto"),
"google/spanner/v1/mutation.proto": label.New("go_googleapis", "google/spanner/v1", "spanner_proto"),
"google/spanner/v1/query_plan.proto": label.New("go_googleapis", "google/spanner/v1", "spanner_proto"),
"google/spanner/v1/result_set.proto": label.New("go_googleapis", "google/spanner/v1", "spanner_proto"),
"google/spanner/v1/spanner.proto": label.New("go_googleapis", "google/spanner/v1", "spanner_proto"),
"google/spanner/v1/transaction.proto": label.New("go_googleapis", "google/spanner/v1", "spanner_proto"),
"google/spanner/v1/type.proto": label.New("go_googleapis", "google/spanner/v1", "spanner_proto"),
"google/storagetransfer/v1/transfer.proto": label.New("go_googleapis", "google/storagetransfer/v1", "storagetransfer_proto"),
"google/storagetransfer/v1/transfer_types.proto": label.New("go_googleapis", "google/storagetransfer/v1", "storagetransfer_proto"),
"google/streetview/publish/v1/resources.proto": label.New("go_googleapis", "google/streetview/publish/v1", "publish_proto"),
"google/streetview/publish/v1/rpcmessages.proto": label.New("go_googleapis", "google/streetview/publish/v1", "publish_proto"),
"google/streetview/publish/v1/streetview_publish.proto": label.New("go_googleapis", "google/streetview/publish/v1", "publish_proto"),
"google/type/color.proto": label.New("go_googleapis", "google/type", "color_proto"),
"google/type/date.proto": label.New("go_googleapis", "google/type", "date_proto"),
"google/type/dayofweek.proto": label.New("go_googleapis", "google/type", "dayofweek_proto"),
"google/type/latlng.proto": label.New("go_googleapis", "google/type", "latlng_proto"),
"google/type/money.proto": label.New("go_googleapis", "google/type", "money_proto"),
"google/type/postal_address.proto": label.New("go_googleapis", "google/type", "postaladdress_proto"),
"google/type/timeofday.proto": label.New("go_googleapis", "google/type", "timeofday_proto"),
"google/watcher/v1/watch.proto": label.New("go_googleapis", "google/watcher/v1", "watcher_proto"),
}

View File

@@ -1,362 +0,0 @@
# This file lists special protos that Gazelle knows how to import. This is used to generate
# code for proto and Go resolvers.
#
# Generated by internal/language/proto/gen/update_proto_csv.go
# Do not edit directly.
#
# proto name,proto label,go import path,go proto label
google/protobuf/any.proto,@com_google_protobuf//:any_proto,github.com/golang/protobuf/ptypes/any,@io_bazel_rules_go//proto/wkt:any_go_proto
google/protobuf/api.proto,@com_google_protobuf//:api_proto,google.golang.org/genproto/protobuf/api,@io_bazel_rules_go//proto/wkt:api_go_proto
google/protobuf/compiler/plugin.proto,@com_google_protobuf//:compiler_plugin_proto,github.com/golang/protobuf/protoc-gen-go/plugin,@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto
google/protobuf/descriptor.proto,@com_google_protobuf//:descriptor_proto,github.com/golang/protobuf/protoc-gen-go/descriptor,@io_bazel_rules_go//proto/wkt:descriptor_go_proto
google/protobuf/duration.proto,@com_google_protobuf//:duration_proto,github.com/golang/protobuf/ptypes/duration,@io_bazel_rules_go//proto/wkt:duration_go_proto
google/protobuf/empty.proto,@com_google_protobuf//:empty_proto,github.com/golang/protobuf/ptypes/empty,@io_bazel_rules_go//proto/wkt:empty_go_proto
google/protobuf/field_mask.proto,@com_google_protobuf//:field_mask_proto,google.golang.org/genproto/protobuf/field_mask,@io_bazel_rules_go//proto/wkt:field_mask_go_proto
google/protobuf/source_context.proto,@com_google_protobuf//:source_context_proto,google.golang.org/genproto/protobuf/source_context,@io_bazel_rules_go//proto/wkt:source_context_go_proto
google/protobuf/struct.proto,@com_google_protobuf//:struct_proto,github.com/golang/protobuf/ptypes/struct,@io_bazel_rules_go//proto/wkt:struct_go_proto
google/protobuf/timestamp.proto,@com_google_protobuf//:timestamp_proto,github.com/golang/protobuf/ptypes/timestamp,@io_bazel_rules_go//proto/wkt:timestamp_go_proto
google/protobuf/type.proto,@com_google_protobuf//:type_proto,google.golang.org/genproto/protobuf/ptype,@io_bazel_rules_go//proto/wkt:type_go_proto
google/protobuf/wrappers.proto,@com_google_protobuf//:wrappers_proto,github.com/golang/protobuf/ptypes/wrappers,@io_bazel_rules_go//proto/wkt:wrappers_go_proto
google/api/annotations.proto,@go_googleapis//google/api:annotations_proto,google.golang.org/genproto/googleapis/api/annotations,@go_googleapis//google/api:annotations_go_proto
google/api/auth.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
google/api/backend.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
google/api/billing.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
google/api/config_change.proto,@go_googleapis//google/api:configchange_proto,google.golang.org/genproto/googleapis/api/configchange,@go_googleapis//google/api:configchange_go_proto
google/api/consumer.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
google/api/context.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
google/api/control.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
google/api/distribution.proto,@go_googleapis//google/api:distribution_proto,google.golang.org/genproto/googleapis/api/distribution,@go_googleapis//google/api:distribution_go_proto
google/api/documentation.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
google/api/endpoint.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
google/api/experimental/authorization_config.proto,@go_googleapis//google/api:api_proto,google.golang.org/genproto/googleapis/api,@go_googleapis//google/api:api_go_proto
google/api/experimental/experimental.proto,@go_googleapis//google/api:api_proto,google.golang.org/genproto/googleapis/api,@go_googleapis//google/api:api_go_proto
google/api/expr/v1alpha1/cel_service.proto,@go_googleapis//google/api/expr/v1alpha1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1alpha1,@go_googleapis//google/api/expr/v1alpha1:expr_go_proto
google/api/expr/v1alpha1/checked.proto,@go_googleapis//google/api/expr/v1alpha1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1alpha1,@go_googleapis//google/api/expr/v1alpha1:expr_go_proto
google/api/expr/v1alpha1/eval.proto,@go_googleapis//google/api/expr/v1alpha1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1alpha1,@go_googleapis//google/api/expr/v1alpha1:expr_go_proto
google/api/expr/v1alpha1/explain.proto,@go_googleapis//google/api/expr/v1alpha1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1alpha1,@go_googleapis//google/api/expr/v1alpha1:expr_go_proto
google/api/expr/v1alpha1/syntax.proto,@go_googleapis//google/api/expr/v1alpha1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1alpha1,@go_googleapis//google/api/expr/v1alpha1:expr_go_proto
google/api/expr/v1alpha1/value.proto,@go_googleapis//google/api/expr/v1alpha1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1alpha1,@go_googleapis//google/api/expr/v1alpha1:expr_go_proto
google/api/expr/v1beta1/decl.proto,@go_googleapis//google/api/expr/v1beta1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1beta1,@go_googleapis//google/api/expr/v1beta1:expr_go_proto
google/api/expr/v1beta1/eval.proto,@go_googleapis//google/api/expr/v1beta1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1beta1,@go_googleapis//google/api/expr/v1beta1:expr_go_proto
google/api/expr/v1beta1/expr.proto,@go_googleapis//google/api/expr/v1beta1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1beta1,@go_googleapis//google/api/expr/v1beta1:expr_go_proto
google/api/expr/v1beta1/source.proto,@go_googleapis//google/api/expr/v1beta1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1beta1,@go_googleapis//google/api/expr/v1beta1:expr_go_proto
google/api/expr/v1beta1/value.proto,@go_googleapis//google/api/expr/v1beta1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1beta1,@go_googleapis//google/api/expr/v1beta1:expr_go_proto
google/api/http.proto,@go_googleapis//google/api:annotations_proto,google.golang.org/genproto/googleapis/api/annotations,@go_googleapis//google/api:annotations_go_proto
google/api/httpbody.proto,@go_googleapis//google/api:httpbody_proto,google.golang.org/genproto/googleapis/api/httpbody,@go_googleapis//google/api:httpbody_go_proto
google/api/label.proto,@go_googleapis//google/api:label_proto,google.golang.org/genproto/googleapis/api/label,@go_googleapis//google/api:label_go_proto
google/api/launch_stage.proto,@go_googleapis//google/api:api_proto,google.golang.org/genproto/googleapis/api,@go_googleapis//google/api:api_go_proto
google/api/log.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
google/api/logging.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
google/api/metric.proto,@go_googleapis//google/api:metric_proto,google.golang.org/genproto/googleapis/api/metric,@go_googleapis//google/api:metric_go_proto
google/api/monitored_resource.proto,@go_googleapis//google/api:monitoredres_proto,google.golang.org/genproto/googleapis/api/monitoredres,@go_googleapis//google/api:monitoredres_go_proto
google/api/monitoring.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
google/api/quota.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
google/api/service.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
google/api/servicecontrol/v1/check_error.proto,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_proto,google.golang.org/genproto/googleapis/api/servicecontrol/v1,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_go_proto
google/api/servicecontrol/v1/distribution.proto,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_proto,google.golang.org/genproto/googleapis/api/servicecontrol/v1,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_go_proto
google/api/servicecontrol/v1/log_entry.proto,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_proto,google.golang.org/genproto/googleapis/api/servicecontrol/v1,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_go_proto
google/api/servicecontrol/v1/metric_value.proto,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_proto,google.golang.org/genproto/googleapis/api/servicecontrol/v1,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_go_proto
google/api/servicecontrol/v1/operation.proto,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_proto,google.golang.org/genproto/googleapis/api/servicecontrol/v1,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_go_proto
google/api/servicecontrol/v1/quota_controller.proto,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_proto,google.golang.org/genproto/googleapis/api/servicecontrol/v1,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_go_proto
google/api/servicecontrol/v1/service_controller.proto,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_proto,google.golang.org/genproto/googleapis/api/servicecontrol/v1,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_go_proto
google/api/servicemanagement/v1/resources.proto,@go_googleapis//google/api/servicemanagement/v1:servicemanagement_proto,google.golang.org/genproto/googleapis/api/servicemanagement/v1,@go_googleapis//google/api/servicemanagement/v1:servicemanagement_go_proto
google/api/servicemanagement/v1/servicemanager.proto,@go_googleapis//google/api/servicemanagement/v1:servicemanagement_proto,google.golang.org/genproto/googleapis/api/servicemanagement/v1,@go_googleapis//google/api/servicemanagement/v1:servicemanagement_go_proto
google/api/source_info.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
google/api/system_parameter.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
google/api/usage.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
google/appengine/legacy/audit_data.proto,@go_googleapis//google/appengine/legacy:legacy_proto,google.golang.org/genproto/googleapis/appengine/legacy,@go_googleapis//google/appengine/legacy:legacy_go_proto
google/appengine/logging/v1/request_log.proto,@go_googleapis//google/appengine/logging/v1:logging_proto,google.golang.org/genproto/googleapis/appengine/logging/v1,@go_googleapis//google/appengine/logging/v1:logging_go_proto
google/appengine/v1/app_yaml.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
google/appengine/v1/appengine.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
google/appengine/v1/application.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
google/appengine/v1/audit_data.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
google/appengine/v1/deploy.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
google/appengine/v1/instance.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
google/appengine/v1/location.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
google/appengine/v1/operation.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
google/appengine/v1/service.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
google/appengine/v1/version.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
google/assistant/embedded/v1alpha1/embedded_assistant.proto,@go_googleapis//google/assistant/embedded/v1alpha1:embedded_proto,google.golang.org/genproto/googleapis/assistant/embedded/v1alpha1,@go_googleapis//google/assistant/embedded/v1alpha1:embedded_go_proto
google/assistant/embedded/v1alpha2/embedded_assistant.proto,@go_googleapis//google/assistant/embedded/v1alpha2:embedded_proto,google.golang.org/genproto/googleapis/assistant/embedded/v1alpha2,@go_googleapis//google/assistant/embedded/v1alpha2:embedded_go_proto
google/bigtable/admin/cluster/v1/bigtable_cluster_data.proto,@go_googleapis//google/bigtable/admin/cluster/v1:cluster_proto,google.golang.org/genproto/googleapis/bigtable/admin/cluster/v1,@go_googleapis//google/bigtable/admin/cluster/v1:cluster_go_proto
google/bigtable/admin/cluster/v1/bigtable_cluster_service.proto,@go_googleapis//google/bigtable/admin/cluster/v1:cluster_proto,google.golang.org/genproto/googleapis/bigtable/admin/cluster/v1,@go_googleapis//google/bigtable/admin/cluster/v1:cluster_go_proto
google/bigtable/admin/cluster/v1/bigtable_cluster_service_messages.proto,@go_googleapis//google/bigtable/admin/cluster/v1:cluster_proto,google.golang.org/genproto/googleapis/bigtable/admin/cluster/v1,@go_googleapis//google/bigtable/admin/cluster/v1:cluster_go_proto
google/bigtable/admin/table/v1/bigtable_table_data.proto,@go_googleapis//google/bigtable/admin/table/v1:table_proto,google.golang.org/genproto/googleapis/bigtable/admin/table/v1,@go_googleapis//google/bigtable/admin/table/v1:table_go_proto
google/bigtable/admin/table/v1/bigtable_table_service.proto,@go_googleapis//google/bigtable/admin/table/v1:table_proto,google.golang.org/genproto/googleapis/bigtable/admin/table/v1,@go_googleapis//google/bigtable/admin/table/v1:table_go_proto
google/bigtable/admin/table/v1/bigtable_table_service_messages.proto,@go_googleapis//google/bigtable/admin/table/v1:table_proto,google.golang.org/genproto/googleapis/bigtable/admin/table/v1,@go_googleapis//google/bigtable/admin/table/v1:table_go_proto
google/bigtable/admin/v2/bigtable_instance_admin.proto,@go_googleapis//google/bigtable/admin/v2:admin_proto,google.golang.org/genproto/googleapis/bigtable/admin/v2,@go_googleapis//google/bigtable/admin/v2:admin_go_proto
google/bigtable/admin/v2/bigtable_table_admin.proto,@go_googleapis//google/bigtable/admin/v2:admin_proto,google.golang.org/genproto/googleapis/bigtable/admin/v2,@go_googleapis//google/bigtable/admin/v2:admin_go_proto
google/bigtable/admin/v2/common.proto,@go_googleapis//google/bigtable/admin/v2:admin_proto,google.golang.org/genproto/googleapis/bigtable/admin/v2,@go_googleapis//google/bigtable/admin/v2:admin_go_proto
google/bigtable/admin/v2/instance.proto,@go_googleapis//google/bigtable/admin/v2:admin_proto,google.golang.org/genproto/googleapis/bigtable/admin/v2,@go_googleapis//google/bigtable/admin/v2:admin_go_proto
google/bigtable/admin/v2/table.proto,@go_googleapis//google/bigtable/admin/v2:admin_proto,google.golang.org/genproto/googleapis/bigtable/admin/v2,@go_googleapis//google/bigtable/admin/v2:admin_go_proto
google/bigtable/v1/bigtable_data.proto,@go_googleapis//google/bigtable/v1:bigtable_proto,google.golang.org/genproto/googleapis/bigtable/v1,@go_googleapis//google/bigtable/v1:bigtable_go_proto
google/bigtable/v1/bigtable_service.proto,@go_googleapis//google/bigtable/v1:bigtable_proto,google.golang.org/genproto/googleapis/bigtable/v1,@go_googleapis//google/bigtable/v1:bigtable_go_proto
google/bigtable/v1/bigtable_service_messages.proto,@go_googleapis//google/bigtable/v1:bigtable_proto,google.golang.org/genproto/googleapis/bigtable/v1,@go_googleapis//google/bigtable/v1:bigtable_go_proto
google/bigtable/v2/bigtable.proto,@go_googleapis//google/bigtable/v2:bigtable_proto,google.golang.org/genproto/googleapis/bigtable/v2,@go_googleapis//google/bigtable/v2:bigtable_go_proto
google/bigtable/v2/data.proto,@go_googleapis//google/bigtable/v2:bigtable_proto,google.golang.org/genproto/googleapis/bigtable/v2,@go_googleapis//google/bigtable/v2:bigtable_go_proto
google/bytestream/bytestream.proto,@go_googleapis//google/bytestream:bytestream_proto,google.golang.org/genproto/googleapis/bytestream,@go_googleapis//google/bytestream:bytestream_go_proto
google/cloud/asset/v1beta1/asset_service.proto,@go_googleapis//google/cloud/asset/v1beta1:asset_proto,google.golang.org/genproto/googleapis/cloud/asset/v1beta1,@go_googleapis//google/cloud/asset/v1beta1:asset_go_proto
google/cloud/asset/v1beta1/assets.proto,@go_googleapis//google/cloud/asset/v1beta1:asset_proto,google.golang.org/genproto/googleapis/cloud/asset/v1beta1,@go_googleapis//google/cloud/asset/v1beta1:asset_go_proto
google/cloud/audit/audit_log.proto,@go_googleapis//google/cloud/audit:audit_proto,google.golang.org/genproto/googleapis/cloud/audit,@go_googleapis//google/cloud/audit:audit_go_proto
google/cloud/automl/v1beta1/annotation_payload.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
google/cloud/automl/v1beta1/classification.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
google/cloud/automl/v1beta1/data_items.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
google/cloud/automl/v1beta1/dataset.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
google/cloud/automl/v1beta1/image.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
google/cloud/automl/v1beta1/io.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
google/cloud/automl/v1beta1/model.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
google/cloud/automl/v1beta1/model_evaluation.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
google/cloud/automl/v1beta1/operations.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
google/cloud/automl/v1beta1/prediction_service.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
google/cloud/automl/v1beta1/service.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
google/cloud/automl/v1beta1/text.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
google/cloud/automl/v1beta1/translation.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
google/cloud/bigquery/datatransfer/v1/datatransfer.proto,@go_googleapis//google/cloud/bigquery/datatransfer/v1:datatransfer_proto,google.golang.org/genproto/googleapis/cloud/bigquery/datatransfer/v1,@go_googleapis//google/cloud/bigquery/datatransfer/v1:datatransfer_go_proto
google/cloud/bigquery/datatransfer/v1/transfer.proto,@go_googleapis//google/cloud/bigquery/datatransfer/v1:datatransfer_proto,google.golang.org/genproto/googleapis/cloud/bigquery/datatransfer/v1,@go_googleapis//google/cloud/bigquery/datatransfer/v1:datatransfer_go_proto
google/cloud/bigquery/logging/v1/audit_data.proto,@go_googleapis//google/cloud/bigquery/logging/v1:logging_proto,google.golang.org/genproto/googleapis/cloud/bigquery/logging/v1,@go_googleapis//google/cloud/bigquery/logging/v1:logging_go_proto
google/cloud/bigquery/storage/v1beta1/avro.proto,@go_googleapis//google/cloud/bigquery/storage/v1beta1:storage_proto,google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1,@go_googleapis//google/cloud/bigquery/storage/v1beta1:storage_go_proto
google/cloud/bigquery/storage/v1beta1/read_options.proto,@go_googleapis//google/cloud/bigquery/storage/v1beta1:storage_proto,google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1,@go_googleapis//google/cloud/bigquery/storage/v1beta1:storage_go_proto
google/cloud/bigquery/storage/v1beta1/storage.proto,@go_googleapis//google/cloud/bigquery/storage/v1beta1:storage_proto,google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1,@go_googleapis//google/cloud/bigquery/storage/v1beta1:storage_go_proto
google/cloud/bigquery/storage/v1beta1/table_reference.proto,@go_googleapis//google/cloud/bigquery/storage/v1beta1:storage_proto,google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1,@go_googleapis//google/cloud/bigquery/storage/v1beta1:storage_go_proto
google/cloud/billing/v1/cloud_billing.proto,@go_googleapis//google/cloud/billing/v1:billing_proto,google.golang.org/genproto/googleapis/cloud/billing/v1,@go_googleapis//google/cloud/billing/v1:billing_go_proto
google/cloud/dataproc/v1/clusters.proto,@go_googleapis//google/cloud/dataproc/v1:dataproc_proto,google.golang.org/genproto/googleapis/cloud/dataproc/v1,@go_googleapis//google/cloud/dataproc/v1:dataproc_go_proto
google/cloud/dataproc/v1/jobs.proto,@go_googleapis//google/cloud/dataproc/v1:dataproc_proto,google.golang.org/genproto/googleapis/cloud/dataproc/v1,@go_googleapis//google/cloud/dataproc/v1:dataproc_go_proto
google/cloud/dataproc/v1/operations.proto,@go_googleapis//google/cloud/dataproc/v1:dataproc_proto,google.golang.org/genproto/googleapis/cloud/dataproc/v1,@go_googleapis//google/cloud/dataproc/v1:dataproc_go_proto
google/cloud/dataproc/v1beta2/clusters.proto,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_proto,google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_go_proto
google/cloud/dataproc/v1beta2/jobs.proto,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_proto,google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_go_proto
google/cloud/dataproc/v1beta2/operations.proto,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_proto,google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_go_proto
google/cloud/dataproc/v1beta2/shared.proto,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_proto,google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_go_proto
google/cloud/dataproc/v1beta2/workflow_templates.proto,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_proto,google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_go_proto
google/cloud/dialogflow/v2/agent.proto,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_go_proto
google/cloud/dialogflow/v2/context.proto,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_go_proto
google/cloud/dialogflow/v2/entity_type.proto,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_go_proto
google/cloud/dialogflow/v2/intent.proto,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_go_proto
google/cloud/dialogflow/v2/session.proto,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_go_proto
google/cloud/dialogflow/v2/session_entity_type.proto,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_go_proto
google/cloud/dialogflow/v2/webhook.proto,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_go_proto
google/cloud/dialogflow/v2beta1/agent.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
google/cloud/dialogflow/v2beta1/audio_config.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
google/cloud/dialogflow/v2beta1/context.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
google/cloud/dialogflow/v2beta1/document.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
google/cloud/dialogflow/v2beta1/entity_type.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
google/cloud/dialogflow/v2beta1/intent.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
google/cloud/dialogflow/v2beta1/knowledge_base.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
google/cloud/dialogflow/v2beta1/session.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
google/cloud/dialogflow/v2beta1/session_entity_type.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
google/cloud/dialogflow/v2beta1/webhook.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
google/cloud/functions/v1beta2/functions.proto,@go_googleapis//google/cloud/functions/v1beta2:functions_proto,google.golang.org/genproto/googleapis/cloud/functions/v1beta2,@go_googleapis//google/cloud/functions/v1beta2:functions_go_proto
google/cloud/functions/v1beta2/operations.proto,@go_googleapis//google/cloud/functions/v1beta2:functions_proto,google.golang.org/genproto/googleapis/cloud/functions/v1beta2,@go_googleapis//google/cloud/functions/v1beta2:functions_go_proto
google/cloud/iot/v1/device_manager.proto,@go_googleapis//google/cloud/iot/v1:iot_proto,google.golang.org/genproto/googleapis/cloud/iot/v1,@go_googleapis//google/cloud/iot/v1:iot_go_proto
google/cloud/iot/v1/resources.proto,@go_googleapis//google/cloud/iot/v1:iot_proto,google.golang.org/genproto/googleapis/cloud/iot/v1,@go_googleapis//google/cloud/iot/v1:iot_go_proto
google/cloud/kms/v1/resources.proto,@go_googleapis//google/cloud/kms/v1:kms_proto,google.golang.org/genproto/googleapis/cloud/kms/v1,@go_googleapis//google/cloud/kms/v1:kms_go_proto
google/cloud/kms/v1/service.proto,@go_googleapis//google/cloud/kms/v1:kms_proto,google.golang.org/genproto/googleapis/cloud/kms/v1,@go_googleapis//google/cloud/kms/v1:kms_go_proto
google/cloud/language/v1/language_service.proto,@go_googleapis//google/cloud/language/v1:language_proto,google.golang.org/genproto/googleapis/cloud/language/v1,@go_googleapis//google/cloud/language/v1:language_go_proto
google/cloud/language/v1beta1/language_service.proto,@go_googleapis//google/cloud/language/v1beta1:language_proto,google.golang.org/genproto/googleapis/cloud/language/v1beta1,@go_googleapis//google/cloud/language/v1beta1:language_go_proto
google/cloud/language/v1beta2/language_service.proto,@go_googleapis//google/cloud/language/v1beta2:language_proto,google.golang.org/genproto/googleapis/cloud/language/v1beta2,@go_googleapis//google/cloud/language/v1beta2:language_go_proto
google/cloud/location/locations.proto,@go_googleapis//google/cloud/location:location_proto,google.golang.org/genproto/googleapis/cloud/location,@go_googleapis//google/cloud/location:location_go_proto
google/cloud/ml/v1/job_service.proto,@go_googleapis//google/cloud/ml/v1:ml_proto,google.golang.org/genproto/googleapis/cloud/ml/v1,@go_googleapis//google/cloud/ml/v1:ml_go_proto
google/cloud/ml/v1/model_service.proto,@go_googleapis//google/cloud/ml/v1:ml_proto,google.golang.org/genproto/googleapis/cloud/ml/v1,@go_googleapis//google/cloud/ml/v1:ml_go_proto
google/cloud/ml/v1/operation_metadata.proto,@go_googleapis//google/cloud/ml/v1:ml_proto,google.golang.org/genproto/googleapis/cloud/ml/v1,@go_googleapis//google/cloud/ml/v1:ml_go_proto
google/cloud/ml/v1/prediction_service.proto,@go_googleapis//google/cloud/ml/v1:ml_proto,google.golang.org/genproto/googleapis/cloud/ml/v1,@go_googleapis//google/cloud/ml/v1:ml_go_proto
google/cloud/ml/v1/project_service.proto,@go_googleapis//google/cloud/ml/v1:ml_proto,google.golang.org/genproto/googleapis/cloud/ml/v1,@go_googleapis//google/cloud/ml/v1:ml_go_proto
google/cloud/oslogin/common/common.proto,@go_googleapis//google/cloud/oslogin/common:common_proto,google.golang.org/genproto/googleapis/cloud/oslogin/common,@go_googleapis//google/cloud/oslogin/common:common_go_proto
google/cloud/oslogin/v1/oslogin.proto,@go_googleapis//google/cloud/oslogin/v1:oslogin_proto,google.golang.org/genproto/googleapis/cloud/oslogin/v1,@go_googleapis//google/cloud/oslogin/v1:oslogin_go_proto
google/cloud/oslogin/v1alpha/oslogin.proto,@go_googleapis//google/cloud/oslogin/v1alpha:oslogin_proto,google.golang.org/genproto/googleapis/cloud/oslogin/v1alpha,@go_googleapis//google/cloud/oslogin/v1alpha:oslogin_go_proto
google/cloud/oslogin/v1beta/oslogin.proto,@go_googleapis//google/cloud/oslogin/v1beta:oslogin_proto,google.golang.org/genproto/googleapis/cloud/oslogin/v1beta,@go_googleapis//google/cloud/oslogin/v1beta:oslogin_go_proto
google/cloud/redis/v1/cloud_redis.proto,@go_googleapis//google/cloud/redis/v1:redis_proto,google.golang.org/genproto/googleapis/cloud/redis/v1,@go_googleapis//google/cloud/redis/v1:redis_go_proto
google/cloud/redis/v1beta1/cloud_redis.proto,@go_googleapis//google/cloud/redis/v1beta1:redis_proto,google.golang.org/genproto/googleapis/cloud/redis/v1beta1,@go_googleapis//google/cloud/redis/v1beta1:redis_go_proto
google/cloud/resourcemanager/v2/folders.proto,@go_googleapis//google/cloud/resourcemanager/v2:resourcemanager_proto,google.golang.org/genproto/googleapis/cloud/resourcemanager/v2,@go_googleapis//google/cloud/resourcemanager/v2:resourcemanager_go_proto
google/cloud/runtimeconfig/v1beta1/resources.proto,@go_googleapis//google/cloud/runtimeconfig/v1beta1:runtimeconfig_proto,google.golang.org/genproto/googleapis/cloud/runtimeconfig/v1beta1,@go_googleapis//google/cloud/runtimeconfig/v1beta1:runtimeconfig_go_proto
google/cloud/runtimeconfig/v1beta1/runtimeconfig.proto,@go_googleapis//google/cloud/runtimeconfig/v1beta1:runtimeconfig_proto,google.golang.org/genproto/googleapis/cloud/runtimeconfig/v1beta1,@go_googleapis//google/cloud/runtimeconfig/v1beta1:runtimeconfig_go_proto
google/cloud/speech/v1/cloud_speech.proto,@go_googleapis//google/cloud/speech/v1:speech_proto,google.golang.org/genproto/googleapis/cloud/speech/v1,@go_googleapis//google/cloud/speech/v1:speech_go_proto
google/cloud/speech/v1p1beta1/cloud_speech.proto,@go_googleapis//google/cloud/speech/v1p1beta1:speech_proto,google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1,@go_googleapis//google/cloud/speech/v1p1beta1:speech_go_proto
google/cloud/support/common.proto,@go_googleapis//google/cloud/support:common_proto,google.golang.org/genproto/googleapis/cloud/support/common,@go_googleapis//google/cloud/support:common_go_proto
google/cloud/support/v1alpha1/cloud_support.proto,@go_googleapis//google/cloud/support/v1alpha1:support_proto,google.golang.org/genproto/googleapis/cloud/support/v1alpha1,@go_googleapis//google/cloud/support/v1alpha1:support_go_proto
google/cloud/tasks/v2beta2/cloudtasks.proto,@go_googleapis//google/cloud/tasks/v2beta2:tasks_proto,google.golang.org/genproto/googleapis/cloud/tasks/v2beta2,@go_googleapis//google/cloud/tasks/v2beta2:tasks_go_proto
google/cloud/tasks/v2beta2/queue.proto,@go_googleapis//google/cloud/tasks/v2beta2:tasks_proto,google.golang.org/genproto/googleapis/cloud/tasks/v2beta2,@go_googleapis//google/cloud/tasks/v2beta2:tasks_go_proto
google/cloud/tasks/v2beta2/target.proto,@go_googleapis//google/cloud/tasks/v2beta2:tasks_proto,google.golang.org/genproto/googleapis/cloud/tasks/v2beta2,@go_googleapis//google/cloud/tasks/v2beta2:tasks_go_proto
google/cloud/tasks/v2beta2/task.proto,@go_googleapis//google/cloud/tasks/v2beta2:tasks_proto,google.golang.org/genproto/googleapis/cloud/tasks/v2beta2,@go_googleapis//google/cloud/tasks/v2beta2:tasks_go_proto
google/cloud/tasks/v2beta3/cloudtasks.proto,@go_googleapis//google/cloud/tasks/v2beta3:tasks_proto,google.golang.org/genproto/googleapis/cloud/tasks/v2beta3,@go_googleapis//google/cloud/tasks/v2beta3:tasks_go_proto
google/cloud/tasks/v2beta3/queue.proto,@go_googleapis//google/cloud/tasks/v2beta3:tasks_proto,google.golang.org/genproto/googleapis/cloud/tasks/v2beta3,@go_googleapis//google/cloud/tasks/v2beta3:tasks_go_proto
google/cloud/tasks/v2beta3/target.proto,@go_googleapis//google/cloud/tasks/v2beta3:tasks_proto,google.golang.org/genproto/googleapis/cloud/tasks/v2beta3,@go_googleapis//google/cloud/tasks/v2beta3:tasks_go_proto
google/cloud/tasks/v2beta3/task.proto,@go_googleapis//google/cloud/tasks/v2beta3:tasks_proto,google.golang.org/genproto/googleapis/cloud/tasks/v2beta3,@go_googleapis//google/cloud/tasks/v2beta3:tasks_go_proto
google/cloud/texttospeech/v1/cloud_tts.proto,@go_googleapis//google/cloud/texttospeech/v1:texttospeech_proto,google.golang.org/genproto/googleapis/cloud/texttospeech/v1,@go_googleapis//google/cloud/texttospeech/v1:texttospeech_go_proto
google/cloud/texttospeech/v1beta1/cloud_tts.proto,@go_googleapis//google/cloud/texttospeech/v1beta1:texttospeech_proto,google.golang.org/genproto/googleapis/cloud/texttospeech/v1beta1,@go_googleapis//google/cloud/texttospeech/v1beta1:texttospeech_go_proto
google/cloud/videointelligence/v1/video_intelligence.proto,@go_googleapis//google/cloud/videointelligence/v1:videointelligence_proto,google.golang.org/genproto/googleapis/cloud/videointelligence/v1,@go_googleapis//google/cloud/videointelligence/v1:videointelligence_go_proto
google/cloud/videointelligence/v1beta1/video_intelligence.proto,@go_googleapis//google/cloud/videointelligence/v1beta1:videointelligence_proto,google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta1,@go_googleapis//google/cloud/videointelligence/v1beta1:videointelligence_go_proto
google/cloud/videointelligence/v1beta2/video_intelligence.proto,@go_googleapis//google/cloud/videointelligence/v1beta2:videointelligence_proto,google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta2,@go_googleapis//google/cloud/videointelligence/v1beta2:videointelligence_go_proto
google/cloud/videointelligence/v1p1beta1/video_intelligence.proto,@go_googleapis//google/cloud/videointelligence/v1p1beta1:videointelligence_proto,google.golang.org/genproto/googleapis/cloud/videointelligence/v1p1beta1,@go_googleapis//google/cloud/videointelligence/v1p1beta1:videointelligence_go_proto
google/cloud/videointelligence/v1p2beta1/video_intelligence.proto,@go_googleapis//google/cloud/videointelligence/v1p2beta1:videointelligence_proto,google.golang.org/genproto/googleapis/cloud/videointelligence/v1p2beta1,@go_googleapis//google/cloud/videointelligence/v1p2beta1:videointelligence_go_proto
google/cloud/vision/v1/geometry.proto,@go_googleapis//google/cloud/vision/v1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1,@go_googleapis//google/cloud/vision/v1:vision_go_proto
google/cloud/vision/v1/image_annotator.proto,@go_googleapis//google/cloud/vision/v1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1,@go_googleapis//google/cloud/vision/v1:vision_go_proto
google/cloud/vision/v1/text_annotation.proto,@go_googleapis//google/cloud/vision/v1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1,@go_googleapis//google/cloud/vision/v1:vision_go_proto
google/cloud/vision/v1/web_detection.proto,@go_googleapis//google/cloud/vision/v1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1,@go_googleapis//google/cloud/vision/v1:vision_go_proto
google/cloud/vision/v1p1beta1/geometry.proto,@go_googleapis//google/cloud/vision/v1p1beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1,@go_googleapis//google/cloud/vision/v1p1beta1:vision_go_proto
google/cloud/vision/v1p1beta1/image_annotator.proto,@go_googleapis//google/cloud/vision/v1p1beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1,@go_googleapis//google/cloud/vision/v1p1beta1:vision_go_proto
google/cloud/vision/v1p1beta1/text_annotation.proto,@go_googleapis//google/cloud/vision/v1p1beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1,@go_googleapis//google/cloud/vision/v1p1beta1:vision_go_proto
google/cloud/vision/v1p1beta1/web_detection.proto,@go_googleapis//google/cloud/vision/v1p1beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1,@go_googleapis//google/cloud/vision/v1p1beta1:vision_go_proto
google/cloud/vision/v1p2beta1/geometry.proto,@go_googleapis//google/cloud/vision/v1p2beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1,@go_googleapis//google/cloud/vision/v1p2beta1:vision_go_proto
google/cloud/vision/v1p2beta1/image_annotator.proto,@go_googleapis//google/cloud/vision/v1p2beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1,@go_googleapis//google/cloud/vision/v1p2beta1:vision_go_proto
google/cloud/vision/v1p2beta1/text_annotation.proto,@go_googleapis//google/cloud/vision/v1p2beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1,@go_googleapis//google/cloud/vision/v1p2beta1:vision_go_proto
google/cloud/vision/v1p2beta1/web_detection.proto,@go_googleapis//google/cloud/vision/v1p2beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1,@go_googleapis//google/cloud/vision/v1p2beta1:vision_go_proto
google/cloud/vision/v1p3beta1/geometry.proto,@go_googleapis//google/cloud/vision/v1p3beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1,@go_googleapis//google/cloud/vision/v1p3beta1:vision_go_proto
google/cloud/vision/v1p3beta1/image_annotator.proto,@go_googleapis//google/cloud/vision/v1p3beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1,@go_googleapis//google/cloud/vision/v1p3beta1:vision_go_proto
google/cloud/vision/v1p3beta1/product_search.proto,@go_googleapis//google/cloud/vision/v1p3beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1,@go_googleapis//google/cloud/vision/v1p3beta1:vision_go_proto
google/cloud/vision/v1p3beta1/product_search_service.proto,@go_googleapis//google/cloud/vision/v1p3beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1,@go_googleapis//google/cloud/vision/v1p3beta1:vision_go_proto
google/cloud/vision/v1p3beta1/text_annotation.proto,@go_googleapis//google/cloud/vision/v1p3beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1,@go_googleapis//google/cloud/vision/v1p3beta1:vision_go_proto
google/cloud/vision/v1p3beta1/web_detection.proto,@go_googleapis//google/cloud/vision/v1p3beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1,@go_googleapis//google/cloud/vision/v1p3beta1:vision_go_proto
google/cloud/websecurityscanner/v1alpha/crawled_url.proto,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_proto,google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_go_proto
google/cloud/websecurityscanner/v1alpha/finding.proto,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_proto,google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_go_proto
google/cloud/websecurityscanner/v1alpha/finding_addon.proto,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_proto,google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_go_proto
google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_proto,google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_go_proto
google/cloud/websecurityscanner/v1alpha/scan_config.proto,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_proto,google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_go_proto
google/cloud/websecurityscanner/v1alpha/scan_run.proto,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_proto,google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_go_proto
google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_proto,google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_go_proto
google/container/v1/cluster_service.proto,@go_googleapis//google/container/v1:container_proto,google.golang.org/genproto/googleapis/container/v1,@go_googleapis//google/container/v1:container_go_proto
google/container/v1alpha1/cluster_service.proto,@go_googleapis//google/container/v1alpha1:container_proto,google.golang.org/genproto/googleapis/container/v1alpha1,@go_googleapis//google/container/v1alpha1:container_go_proto
google/container/v1beta1/cluster_service.proto,@go_googleapis//google/container/v1beta1:container_proto,google.golang.org/genproto/googleapis/container/v1beta1,@go_googleapis//google/container/v1beta1:container_go_proto
google/datastore/admin/v1/datastore_admin.proto,@go_googleapis//google/datastore/admin/v1:admin_proto,google.golang.org/genproto/googleapis/datastore/admin/v1,@go_googleapis//google/datastore/admin/v1:admin_go_proto
google/datastore/admin/v1/index.proto,@go_googleapis//google/datastore/admin/v1:admin_proto,google.golang.org/genproto/googleapis/datastore/admin/v1,@go_googleapis//google/datastore/admin/v1:admin_go_proto
google/datastore/admin/v1beta1/datastore_admin.proto,@go_googleapis//google/datastore/admin/v1beta1:admin_proto,google.golang.org/genproto/googleapis/datastore/admin/v1beta1,@go_googleapis//google/datastore/admin/v1beta1:admin_go_proto
google/datastore/v1/datastore.proto,@go_googleapis//google/datastore/v1:datastore_proto,google.golang.org/genproto/googleapis/datastore/v1,@go_googleapis//google/datastore/v1:datastore_go_proto
google/datastore/v1/entity.proto,@go_googleapis//google/datastore/v1:datastore_proto,google.golang.org/genproto/googleapis/datastore/v1,@go_googleapis//google/datastore/v1:datastore_go_proto
google/datastore/v1/query.proto,@go_googleapis//google/datastore/v1:datastore_proto,google.golang.org/genproto/googleapis/datastore/v1,@go_googleapis//google/datastore/v1:datastore_go_proto
google/datastore/v1beta3/datastore.proto,@go_googleapis//google/datastore/v1beta3:datastore_proto,google.golang.org/genproto/googleapis/datastore/v1beta3,@go_googleapis//google/datastore/v1beta3:datastore_go_proto
google/datastore/v1beta3/entity.proto,@go_googleapis//google/datastore/v1beta3:datastore_proto,google.golang.org/genproto/googleapis/datastore/v1beta3,@go_googleapis//google/datastore/v1beta3:datastore_go_proto
google/datastore/v1beta3/query.proto,@go_googleapis//google/datastore/v1beta3:datastore_proto,google.golang.org/genproto/googleapis/datastore/v1beta3,@go_googleapis//google/datastore/v1beta3:datastore_go_proto
google/devtools/build/v1/build_events.proto,@go_googleapis//google/devtools/build/v1:build_proto,google.golang.org/genproto/googleapis/devtools/build/v1,@go_googleapis//google/devtools/build/v1:build_go_proto
google/devtools/build/v1/build_status.proto,@go_googleapis//google/devtools/build/v1:build_proto,google.golang.org/genproto/googleapis/devtools/build/v1,@go_googleapis//google/devtools/build/v1:build_go_proto
google/devtools/build/v1/publish_build_event.proto,@go_googleapis//google/devtools/build/v1:build_proto,google.golang.org/genproto/googleapis/devtools/build/v1,@go_googleapis//google/devtools/build/v1:build_go_proto
google/devtools/cloudbuild/v1/cloudbuild.proto,@go_googleapis//google/devtools/cloudbuild/v1:cloudbuild_proto,google.golang.org/genproto/googleapis/devtools/cloudbuild/v1,@go_googleapis//google/devtools/cloudbuild/v1:cloudbuild_go_proto
google/devtools/clouddebugger/v2/controller.proto,@go_googleapis//google/devtools/clouddebugger/v2:clouddebugger_proto,google.golang.org/genproto/googleapis/devtools/clouddebugger/v2,@go_googleapis//google/devtools/clouddebugger/v2:clouddebugger_go_proto
google/devtools/clouddebugger/v2/data.proto,@go_googleapis//google/devtools/clouddebugger/v2:clouddebugger_proto,google.golang.org/genproto/googleapis/devtools/clouddebugger/v2,@go_googleapis//google/devtools/clouddebugger/v2:clouddebugger_go_proto
google/devtools/clouddebugger/v2/debugger.proto,@go_googleapis//google/devtools/clouddebugger/v2:clouddebugger_proto,google.golang.org/genproto/googleapis/devtools/clouddebugger/v2,@go_googleapis//google/devtools/clouddebugger/v2:clouddebugger_go_proto
google/devtools/clouderrorreporting/v1beta1/common.proto,@go_googleapis//google/devtools/clouderrorreporting/v1beta1:clouderrorreporting_proto,google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1,@go_googleapis//google/devtools/clouderrorreporting/v1beta1:clouderrorreporting_go_proto
google/devtools/clouderrorreporting/v1beta1/error_group_service.proto,@go_googleapis//google/devtools/clouderrorreporting/v1beta1:clouderrorreporting_proto,google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1,@go_googleapis//google/devtools/clouderrorreporting/v1beta1:clouderrorreporting_go_proto
google/devtools/clouderrorreporting/v1beta1/error_stats_service.proto,@go_googleapis//google/devtools/clouderrorreporting/v1beta1:clouderrorreporting_proto,google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1,@go_googleapis//google/devtools/clouderrorreporting/v1beta1:clouderrorreporting_go_proto
google/devtools/clouderrorreporting/v1beta1/report_errors_service.proto,@go_googleapis//google/devtools/clouderrorreporting/v1beta1:clouderrorreporting_proto,google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1,@go_googleapis//google/devtools/clouderrorreporting/v1beta1:clouderrorreporting_go_proto
google/devtools/cloudprofiler/v2/profiler.proto,@go_googleapis//google/devtools/cloudprofiler/v2:cloudprofiler_proto,google.golang.org/genproto/googleapis/devtools/cloudprofiler/v2,@go_googleapis//google/devtools/cloudprofiler/v2:cloudprofiler_go_proto
google/devtools/cloudtrace/v1/trace.proto,@go_googleapis//google/devtools/cloudtrace/v1:cloudtrace_proto,google.golang.org/genproto/googleapis/devtools/cloudtrace/v1,@go_googleapis//google/devtools/cloudtrace/v1:cloudtrace_go_proto
google/devtools/cloudtrace/v2/trace.proto,@go_googleapis//google/devtools/cloudtrace/v2:cloudtrace_proto,google.golang.org/genproto/googleapis/devtools/cloudtrace/v2,@go_googleapis//google/devtools/cloudtrace/v2:cloudtrace_go_proto
google/devtools/cloudtrace/v2/tracing.proto,@go_googleapis//google/devtools/cloudtrace/v2:cloudtrace_proto,google.golang.org/genproto/googleapis/devtools/cloudtrace/v2,@go_googleapis//google/devtools/cloudtrace/v2:cloudtrace_go_proto
google/devtools/containeranalysis/v1alpha1/bill_of_materials.proto,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1alpha1,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_go_proto
google/devtools/containeranalysis/v1alpha1/containeranalysis.proto,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1alpha1,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_go_proto
google/devtools/containeranalysis/v1alpha1/image_basis.proto,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1alpha1,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_go_proto
google/devtools/containeranalysis/v1alpha1/package_vulnerability.proto,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1alpha1,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_go_proto
google/devtools/containeranalysis/v1alpha1/provenance.proto,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1alpha1,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_go_proto
google/devtools/containeranalysis/v1alpha1/source_context.proto,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1alpha1,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_go_proto
google/devtools/containeranalysis/v1beta1/attestation/attestation.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/attestation:attestation_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/attestation,@go_googleapis//google/devtools/containeranalysis/v1beta1/attestation:attestation_go_proto
google/devtools/containeranalysis/v1beta1/build/build.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/build:build_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/build,@go_googleapis//google/devtools/containeranalysis/v1beta1/build:build_go_proto
google/devtools/containeranalysis/v1beta1/common/common.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/common:common_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/common,@go_googleapis//google/devtools/containeranalysis/v1beta1/common:common_go_proto
google/devtools/containeranalysis/v1beta1/containeranalysis.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1:containeranalysis_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1,@go_googleapis//google/devtools/containeranalysis/v1beta1:containeranalysis_go_proto
google/devtools/containeranalysis/v1beta1/deployment/deployment.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/deployment:deployment_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/deployment,@go_googleapis//google/devtools/containeranalysis/v1beta1/deployment:deployment_go_proto
google/devtools/containeranalysis/v1beta1/discovery/discovery.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/discovery:discovery_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/discovery,@go_googleapis//google/devtools/containeranalysis/v1beta1/discovery:discovery_go_proto
google/devtools/containeranalysis/v1beta1/grafeas/grafeas.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/grafeas:grafeas_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas,@go_googleapis//google/devtools/containeranalysis/v1beta1/grafeas:grafeas_go_proto
google/devtools/containeranalysis/v1beta1/image/image.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/image:image_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/image,@go_googleapis//google/devtools/containeranalysis/v1beta1/image:image_go_proto
google/devtools/containeranalysis/v1beta1/package/package.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/package:package_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/package,@go_googleapis//google/devtools/containeranalysis/v1beta1/package:package_go_proto
google/devtools/containeranalysis/v1beta1/provenance/provenance.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/provenance:provenance_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/provenance,@go_googleapis//google/devtools/containeranalysis/v1beta1/provenance:provenance_go_proto
google/devtools/containeranalysis/v1beta1/source/source.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/source:source_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/source,@go_googleapis//google/devtools/containeranalysis/v1beta1/source:source_go_proto
google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/vulnerability:vulnerability_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/vulnerability,@go_googleapis//google/devtools/containeranalysis/v1beta1/vulnerability:vulnerability_go_proto
google/devtools/remoteexecution/v1test/remote_execution.proto,@go_googleapis//google/devtools/remoteexecution/v1test:remoteexecution_proto,google.golang.org/genproto/googleapis/devtools/remoteexecution/v1test,@go_googleapis//google/devtools/remoteexecution/v1test:remoteexecution_go_proto
google/devtools/remoteworkers/v1test2/bots.proto,@go_googleapis//google/devtools/remoteworkers/v1test2:remoteworkers_proto,google.golang.org/genproto/googleapis/devtools/remoteworkers/v1test2,@go_googleapis//google/devtools/remoteworkers/v1test2:remoteworkers_go_proto
google/devtools/remoteworkers/v1test2/command.proto,@go_googleapis//google/devtools/remoteworkers/v1test2:remoteworkers_proto,google.golang.org/genproto/googleapis/devtools/remoteworkers/v1test2,@go_googleapis//google/devtools/remoteworkers/v1test2:remoteworkers_go_proto
google/devtools/remoteworkers/v1test2/tasks.proto,@go_googleapis//google/devtools/remoteworkers/v1test2:remoteworkers_proto,google.golang.org/genproto/googleapis/devtools/remoteworkers/v1test2,@go_googleapis//google/devtools/remoteworkers/v1test2:remoteworkers_go_proto
google/devtools/remoteworkers/v1test2/worker.proto,@go_googleapis//google/devtools/remoteworkers/v1test2:remoteworkers_proto,google.golang.org/genproto/googleapis/devtools/remoteworkers/v1test2,@go_googleapis//google/devtools/remoteworkers/v1test2:remoteworkers_go_proto
google/devtools/resultstore/v2/action.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
google/devtools/resultstore/v2/common.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
google/devtools/resultstore/v2/configuration.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
google/devtools/resultstore/v2/configured_target.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
google/devtools/resultstore/v2/coverage.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
google/devtools/resultstore/v2/coverage_summary.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
google/devtools/resultstore/v2/file.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
google/devtools/resultstore/v2/file_set.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
google/devtools/resultstore/v2/invocation.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
google/devtools/resultstore/v2/resultstore_download.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
google/devtools/resultstore/v2/resultstore_file_download.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
google/devtools/resultstore/v2/target.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
google/devtools/resultstore/v2/test_suite.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
google/devtools/source/v1/source_context.proto,@go_googleapis//google/devtools/source/v1:source_proto,google.golang.org/genproto/googleapis/devtools/source/v1,@go_googleapis//google/devtools/source/v1:source_go_proto
google/devtools/sourcerepo/v1/sourcerepo.proto,@go_googleapis//google/devtools/sourcerepo/v1:sourcerepo_proto,google.golang.org/genproto/googleapis/devtools/sourcerepo/v1,@go_googleapis//google/devtools/sourcerepo/v1:sourcerepo_go_proto
google/example/library/v1/library.proto,@go_googleapis//google/example/library/v1:library_proto,google.golang.org/genproto/googleapis/example/library/v1,@go_googleapis//google/example/library/v1:library_go_proto
google/firestore/admin/v1beta1/firestore_admin.proto,@go_googleapis//google/firestore/admin/v1beta1:admin_proto,google.golang.org/genproto/googleapis/firestore/admin/v1beta1,@go_googleapis//google/firestore/admin/v1beta1:admin_go_proto
google/firestore/admin/v1beta1/index.proto,@go_googleapis//google/firestore/admin/v1beta1:admin_proto,google.golang.org/genproto/googleapis/firestore/admin/v1beta1,@go_googleapis//google/firestore/admin/v1beta1:admin_go_proto
google/firestore/admin/v1beta2/field.proto,@go_googleapis//google/firestore/admin/v1beta2:admin_proto,google.golang.org/genproto/googleapis/firestore/admin/v1beta2,@go_googleapis//google/firestore/admin/v1beta2:admin_go_proto
google/firestore/admin/v1beta2/firestore_admin.proto,@go_googleapis//google/firestore/admin/v1beta2:admin_proto,google.golang.org/genproto/googleapis/firestore/admin/v1beta2,@go_googleapis//google/firestore/admin/v1beta2:admin_go_proto
google/firestore/admin/v1beta2/index.proto,@go_googleapis//google/firestore/admin/v1beta2:admin_proto,google.golang.org/genproto/googleapis/firestore/admin/v1beta2,@go_googleapis//google/firestore/admin/v1beta2:admin_go_proto
google/firestore/admin/v1beta2/operation.proto,@go_googleapis//google/firestore/admin/v1beta2:admin_proto,google.golang.org/genproto/googleapis/firestore/admin/v1beta2,@go_googleapis//google/firestore/admin/v1beta2:admin_go_proto
google/firestore/v1beta1/common.proto,@go_googleapis//google/firestore/v1beta1:firestore_proto,google.golang.org/genproto/googleapis/firestore/v1beta1,@go_googleapis//google/firestore/v1beta1:firestore_go_proto
google/firestore/v1beta1/document.proto,@go_googleapis//google/firestore/v1beta1:firestore_proto,google.golang.org/genproto/googleapis/firestore/v1beta1,@go_googleapis//google/firestore/v1beta1:firestore_go_proto
google/firestore/v1beta1/firestore.proto,@go_googleapis//google/firestore/v1beta1:firestore_proto,google.golang.org/genproto/googleapis/firestore/v1beta1,@go_googleapis//google/firestore/v1beta1:firestore_go_proto
google/firestore/v1beta1/query.proto,@go_googleapis//google/firestore/v1beta1:firestore_proto,google.golang.org/genproto/googleapis/firestore/v1beta1,@go_googleapis//google/firestore/v1beta1:firestore_go_proto
google/firestore/v1beta1/write.proto,@go_googleapis//google/firestore/v1beta1:firestore_proto,google.golang.org/genproto/googleapis/firestore/v1beta1,@go_googleapis//google/firestore/v1beta1:firestore_go_proto
google/genomics/v1/annotations.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
google/genomics/v1/cigar.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
google/genomics/v1/datasets.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
google/genomics/v1/operations.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
google/genomics/v1/position.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
google/genomics/v1/range.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
google/genomics/v1/readalignment.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
google/genomics/v1/readgroup.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
google/genomics/v1/readgroupset.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
google/genomics/v1/reads.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
google/genomics/v1/references.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
google/genomics/v1/variants.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
google/genomics/v1alpha2/pipelines.proto,@go_googleapis//google/genomics/v1alpha2:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1alpha2,@go_googleapis//google/genomics/v1alpha2:genomics_go_proto
google/home/graph/v1/device.proto,@go_googleapis//google/home/graph/v1:graph_proto,google.golang.org/genproto/googleapis/home/graph/v1,@go_googleapis//google/home/graph/v1:graph_go_proto
google/home/graph/v1/homegraph.proto,@go_googleapis//google/home/graph/v1:graph_proto,google.golang.org/genproto/googleapis/home/graph/v1,@go_googleapis//google/home/graph/v1:graph_go_proto
google/iam/admin/v1/iam.proto,@go_googleapis//google/iam/admin/v1:admin_proto,google.golang.org/genproto/googleapis/iam/admin/v1,@go_googleapis//google/iam/admin/v1:admin_go_proto
google/iam/credentials/v1/common.proto,@go_googleapis//google/iam/credentials/v1:credentials_proto,google.golang.org/genproto/googleapis/iam/credentials/v1,@go_googleapis//google/iam/credentials/v1:credentials_go_proto
google/iam/credentials/v1/iamcredentials.proto,@go_googleapis//google/iam/credentials/v1:credentials_proto,google.golang.org/genproto/googleapis/iam/credentials/v1,@go_googleapis//google/iam/credentials/v1:credentials_go_proto
google/iam/v1/iam_policy.proto,@go_googleapis//google/iam/v1:iam_proto,google.golang.org/genproto/googleapis/iam/v1,@go_googleapis//google/iam/v1:iam_go_proto
google/iam/v1/logging/audit_data.proto,@go_googleapis//google/iam/v1/logging:logging_proto,google.golang.org/genproto/googleapis/iam/v1/logging,@go_googleapis//google/iam/v1/logging:logging_go_proto
google/iam/v1/policy.proto,@go_googleapis//google/iam/v1:iam_proto,google.golang.org/genproto/googleapis/iam/v1,@go_googleapis//google/iam/v1:iam_go_proto
google/logging/type/http_request.proto,@go_googleapis//google/logging/type:ltype_proto,google.golang.org/genproto/googleapis/logging/type,@go_googleapis//google/logging/type:ltype_go_proto
google/logging/type/log_severity.proto,@go_googleapis//google/logging/type:ltype_proto,google.golang.org/genproto/googleapis/logging/type,@go_googleapis//google/logging/type:ltype_go_proto
google/logging/v2/log_entry.proto,@go_googleapis//google/logging/v2:logging_proto,google.golang.org/genproto/googleapis/logging/v2,@go_googleapis//google/logging/v2:logging_go_proto
google/logging/v2/logging.proto,@go_googleapis//google/logging/v2:logging_proto,google.golang.org/genproto/googleapis/logging/v2,@go_googleapis//google/logging/v2:logging_go_proto
google/logging/v2/logging_config.proto,@go_googleapis//google/logging/v2:logging_proto,google.golang.org/genproto/googleapis/logging/v2,@go_googleapis//google/logging/v2:logging_go_proto
google/logging/v2/logging_metrics.proto,@go_googleapis//google/logging/v2:logging_proto,google.golang.org/genproto/googleapis/logging/v2,@go_googleapis//google/logging/v2:logging_go_proto
google/longrunning/operations.proto,@go_googleapis//google/longrunning:longrunning_proto,google.golang.org/genproto/googleapis/longrunning,@go_googleapis//google/longrunning:longrunning_go_proto
google/monitoring/v3/alert.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
google/monitoring/v3/alert_service.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
google/monitoring/v3/common.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
google/monitoring/v3/dropped_labels.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
google/monitoring/v3/group.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
google/monitoring/v3/group_service.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
google/monitoring/v3/metric.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
google/monitoring/v3/metric_service.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
google/monitoring/v3/mutation_record.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
google/monitoring/v3/notification.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
google/monitoring/v3/notification_service.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
google/monitoring/v3/span_context.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
google/monitoring/v3/uptime.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
google/monitoring/v3/uptime_service.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
google/privacy/dlp/v2/dlp.proto,@go_googleapis//google/privacy/dlp/v2:dlp_proto,google.golang.org/genproto/googleapis/privacy/dlp/v2,@go_googleapis//google/privacy/dlp/v2:dlp_go_proto
google/privacy/dlp/v2/storage.proto,@go_googleapis//google/privacy/dlp/v2:dlp_proto,google.golang.org/genproto/googleapis/privacy/dlp/v2,@go_googleapis//google/privacy/dlp/v2:dlp_go_proto
google/pubsub/v1/pubsub.proto,@go_googleapis//google/pubsub/v1:pubsub_proto,google.golang.org/genproto/googleapis/pubsub/v1,@go_googleapis//google/pubsub/v1:pubsub_go_proto
google/pubsub/v1beta2/pubsub.proto,@go_googleapis//google/pubsub/v1beta2:pubsub_proto,google.golang.org/genproto/googleapis/pubsub/v1beta2,@go_googleapis//google/pubsub/v1beta2:pubsub_go_proto
google/rpc/code.proto,@go_googleapis//google/rpc:code_proto,google.golang.org/genproto/googleapis/rpc/code,@go_googleapis//google/rpc:code_go_proto
google/rpc/error_details.proto,@go_googleapis//google/rpc:errdetails_proto,google.golang.org/genproto/googleapis/rpc/errdetails,@go_googleapis//google/rpc:errdetails_go_proto
google/rpc/status.proto,@go_googleapis//google/rpc:status_proto,google.golang.org/genproto/googleapis/rpc/status,@go_googleapis//google/rpc:status_go_proto
google/spanner/admin/database/v1/spanner_database_admin.proto,@go_googleapis//google/spanner/admin/database/v1:database_proto,google.golang.org/genproto/googleapis/spanner/admin/database/v1,@go_googleapis//google/spanner/admin/database/v1:database_go_proto
google/spanner/admin/instance/v1/spanner_instance_admin.proto,@go_googleapis//google/spanner/admin/instance/v1:instance_proto,google.golang.org/genproto/googleapis/spanner/admin/instance/v1,@go_googleapis//google/spanner/admin/instance/v1:instance_go_proto
google/spanner/v1/keys.proto,@go_googleapis//google/spanner/v1:spanner_proto,google.golang.org/genproto/googleapis/spanner/v1,@go_googleapis//google/spanner/v1:spanner_go_proto
google/spanner/v1/mutation.proto,@go_googleapis//google/spanner/v1:spanner_proto,google.golang.org/genproto/googleapis/spanner/v1,@go_googleapis//google/spanner/v1:spanner_go_proto
google/spanner/v1/query_plan.proto,@go_googleapis//google/spanner/v1:spanner_proto,google.golang.org/genproto/googleapis/spanner/v1,@go_googleapis//google/spanner/v1:spanner_go_proto
google/spanner/v1/result_set.proto,@go_googleapis//google/spanner/v1:spanner_proto,google.golang.org/genproto/googleapis/spanner/v1,@go_googleapis//google/spanner/v1:spanner_go_proto
google/spanner/v1/spanner.proto,@go_googleapis//google/spanner/v1:spanner_proto,google.golang.org/genproto/googleapis/spanner/v1,@go_googleapis//google/spanner/v1:spanner_go_proto
google/spanner/v1/transaction.proto,@go_googleapis//google/spanner/v1:spanner_proto,google.golang.org/genproto/googleapis/spanner/v1,@go_googleapis//google/spanner/v1:spanner_go_proto
google/spanner/v1/type.proto,@go_googleapis//google/spanner/v1:spanner_proto,google.golang.org/genproto/googleapis/spanner/v1,@go_googleapis//google/spanner/v1:spanner_go_proto
google/storagetransfer/v1/transfer.proto,@go_googleapis//google/storagetransfer/v1:storagetransfer_proto,google.golang.org/genproto/googleapis/storagetransfer/v1,@go_googleapis//google/storagetransfer/v1:storagetransfer_go_proto
google/storagetransfer/v1/transfer_types.proto,@go_googleapis//google/storagetransfer/v1:storagetransfer_proto,google.golang.org/genproto/googleapis/storagetransfer/v1,@go_googleapis//google/storagetransfer/v1:storagetransfer_go_proto
google/streetview/publish/v1/resources.proto,@go_googleapis//google/streetview/publish/v1:publish_proto,google.golang.org/genproto/googleapis/streetview/publish/v1,@go_googleapis//google/streetview/publish/v1:publish_go_proto
google/streetview/publish/v1/rpcmessages.proto,@go_googleapis//google/streetview/publish/v1:publish_proto,google.golang.org/genproto/googleapis/streetview/publish/v1,@go_googleapis//google/streetview/publish/v1:publish_go_proto
google/streetview/publish/v1/streetview_publish.proto,@go_googleapis//google/streetview/publish/v1:publish_proto,google.golang.org/genproto/googleapis/streetview/publish/v1,@go_googleapis//google/streetview/publish/v1:publish_go_proto
google/type/color.proto,@go_googleapis//google/type:color_proto,google.golang.org/genproto/googleapis/type/color,@go_googleapis//google/type:color_go_proto
google/type/date.proto,@go_googleapis//google/type:date_proto,google.golang.org/genproto/googleapis/type/date,@go_googleapis//google/type:date_go_proto
google/type/dayofweek.proto,@go_googleapis//google/type:dayofweek_proto,google.golang.org/genproto/googleapis/type/dayofweek,@go_googleapis//google/type:dayofweek_go_proto
google/type/latlng.proto,@go_googleapis//google/type:latlng_proto,google.golang.org/genproto/googleapis/type/latlng,@go_googleapis//google/type:latlng_go_proto
google/type/money.proto,@go_googleapis//google/type:money_proto,google.golang.org/genproto/googleapis/type/money,@go_googleapis//google/type:money_go_proto
google/type/postal_address.proto,@go_googleapis//google/type:postaladdress_proto,google.golang.org/genproto/googleapis/type/postaladdress,@go_googleapis//google/type:postaladdress_go_proto
google/type/timeofday.proto,@go_googleapis//google/type:timeofday_proto,google.golang.org/genproto/googleapis/type/timeofday,@go_googleapis//google/type:timeofday_go_proto
google/watcher/v1/watch.proto,@go_googleapis//google/watcher/v1:watcher_proto,google.golang.org/genproto/googleapis/watcher/v1,@go_googleapis//google/watcher/v1:watcher_go_proto
1 # This file lists special protos that Gazelle knows how to import. This is used to generate
2 # code for proto and Go resolvers.
3 #
4 # Generated by internal/language/proto/gen/update_proto_csv.go
5 # Do not edit directly.
6 #
7 # proto name,proto label,go import path,go proto label
8 google/protobuf/any.proto,@com_google_protobuf//:any_proto,github.com/golang/protobuf/ptypes/any,@io_bazel_rules_go//proto/wkt:any_go_proto
9 google/protobuf/api.proto,@com_google_protobuf//:api_proto,google.golang.org/genproto/protobuf/api,@io_bazel_rules_go//proto/wkt:api_go_proto
10 google/protobuf/compiler/plugin.proto,@com_google_protobuf//:compiler_plugin_proto,github.com/golang/protobuf/protoc-gen-go/plugin,@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto
11 google/protobuf/descriptor.proto,@com_google_protobuf//:descriptor_proto,github.com/golang/protobuf/protoc-gen-go/descriptor,@io_bazel_rules_go//proto/wkt:descriptor_go_proto
12 google/protobuf/duration.proto,@com_google_protobuf//:duration_proto,github.com/golang/protobuf/ptypes/duration,@io_bazel_rules_go//proto/wkt:duration_go_proto
13 google/protobuf/empty.proto,@com_google_protobuf//:empty_proto,github.com/golang/protobuf/ptypes/empty,@io_bazel_rules_go//proto/wkt:empty_go_proto
14 google/protobuf/field_mask.proto,@com_google_protobuf//:field_mask_proto,google.golang.org/genproto/protobuf/field_mask,@io_bazel_rules_go//proto/wkt:field_mask_go_proto
15 google/protobuf/source_context.proto,@com_google_protobuf//:source_context_proto,google.golang.org/genproto/protobuf/source_context,@io_bazel_rules_go//proto/wkt:source_context_go_proto
16 google/protobuf/struct.proto,@com_google_protobuf//:struct_proto,github.com/golang/protobuf/ptypes/struct,@io_bazel_rules_go//proto/wkt:struct_go_proto
17 google/protobuf/timestamp.proto,@com_google_protobuf//:timestamp_proto,github.com/golang/protobuf/ptypes/timestamp,@io_bazel_rules_go//proto/wkt:timestamp_go_proto
18 google/protobuf/type.proto,@com_google_protobuf//:type_proto,google.golang.org/genproto/protobuf/ptype,@io_bazel_rules_go//proto/wkt:type_go_proto
19 google/protobuf/wrappers.proto,@com_google_protobuf//:wrappers_proto,github.com/golang/protobuf/ptypes/wrappers,@io_bazel_rules_go//proto/wkt:wrappers_go_proto
20 google/api/annotations.proto,@go_googleapis//google/api:annotations_proto,google.golang.org/genproto/googleapis/api/annotations,@go_googleapis//google/api:annotations_go_proto
21 google/api/auth.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
22 google/api/backend.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
23 google/api/billing.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
24 google/api/config_change.proto,@go_googleapis//google/api:configchange_proto,google.golang.org/genproto/googleapis/api/configchange,@go_googleapis//google/api:configchange_go_proto
25 google/api/consumer.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
26 google/api/context.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
27 google/api/control.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
28 google/api/distribution.proto,@go_googleapis//google/api:distribution_proto,google.golang.org/genproto/googleapis/api/distribution,@go_googleapis//google/api:distribution_go_proto
29 google/api/documentation.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
30 google/api/endpoint.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
31 google/api/experimental/authorization_config.proto,@go_googleapis//google/api:api_proto,google.golang.org/genproto/googleapis/api,@go_googleapis//google/api:api_go_proto
32 google/api/experimental/experimental.proto,@go_googleapis//google/api:api_proto,google.golang.org/genproto/googleapis/api,@go_googleapis//google/api:api_go_proto
33 google/api/expr/v1alpha1/cel_service.proto,@go_googleapis//google/api/expr/v1alpha1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1alpha1,@go_googleapis//google/api/expr/v1alpha1:expr_go_proto
34 google/api/expr/v1alpha1/checked.proto,@go_googleapis//google/api/expr/v1alpha1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1alpha1,@go_googleapis//google/api/expr/v1alpha1:expr_go_proto
35 google/api/expr/v1alpha1/eval.proto,@go_googleapis//google/api/expr/v1alpha1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1alpha1,@go_googleapis//google/api/expr/v1alpha1:expr_go_proto
36 google/api/expr/v1alpha1/explain.proto,@go_googleapis//google/api/expr/v1alpha1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1alpha1,@go_googleapis//google/api/expr/v1alpha1:expr_go_proto
37 google/api/expr/v1alpha1/syntax.proto,@go_googleapis//google/api/expr/v1alpha1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1alpha1,@go_googleapis//google/api/expr/v1alpha1:expr_go_proto
38 google/api/expr/v1alpha1/value.proto,@go_googleapis//google/api/expr/v1alpha1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1alpha1,@go_googleapis//google/api/expr/v1alpha1:expr_go_proto
39 google/api/expr/v1beta1/decl.proto,@go_googleapis//google/api/expr/v1beta1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1beta1,@go_googleapis//google/api/expr/v1beta1:expr_go_proto
40 google/api/expr/v1beta1/eval.proto,@go_googleapis//google/api/expr/v1beta1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1beta1,@go_googleapis//google/api/expr/v1beta1:expr_go_proto
41 google/api/expr/v1beta1/expr.proto,@go_googleapis//google/api/expr/v1beta1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1beta1,@go_googleapis//google/api/expr/v1beta1:expr_go_proto
42 google/api/expr/v1beta1/source.proto,@go_googleapis//google/api/expr/v1beta1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1beta1,@go_googleapis//google/api/expr/v1beta1:expr_go_proto
43 google/api/expr/v1beta1/value.proto,@go_googleapis//google/api/expr/v1beta1:expr_proto,google.golang.org/genproto/googleapis/api/expr/v1beta1,@go_googleapis//google/api/expr/v1beta1:expr_go_proto
44 google/api/http.proto,@go_googleapis//google/api:annotations_proto,google.golang.org/genproto/googleapis/api/annotations,@go_googleapis//google/api:annotations_go_proto
45 google/api/httpbody.proto,@go_googleapis//google/api:httpbody_proto,google.golang.org/genproto/googleapis/api/httpbody,@go_googleapis//google/api:httpbody_go_proto
46 google/api/label.proto,@go_googleapis//google/api:label_proto,google.golang.org/genproto/googleapis/api/label,@go_googleapis//google/api:label_go_proto
47 google/api/launch_stage.proto,@go_googleapis//google/api:api_proto,google.golang.org/genproto/googleapis/api,@go_googleapis//google/api:api_go_proto
48 google/api/log.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
49 google/api/logging.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
50 google/api/metric.proto,@go_googleapis//google/api:metric_proto,google.golang.org/genproto/googleapis/api/metric,@go_googleapis//google/api:metric_go_proto
51 google/api/monitored_resource.proto,@go_googleapis//google/api:monitoredres_proto,google.golang.org/genproto/googleapis/api/monitoredres,@go_googleapis//google/api:monitoredres_go_proto
52 google/api/monitoring.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
53 google/api/quota.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
54 google/api/service.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
55 google/api/servicecontrol/v1/check_error.proto,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_proto,google.golang.org/genproto/googleapis/api/servicecontrol/v1,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_go_proto
56 google/api/servicecontrol/v1/distribution.proto,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_proto,google.golang.org/genproto/googleapis/api/servicecontrol/v1,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_go_proto
57 google/api/servicecontrol/v1/log_entry.proto,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_proto,google.golang.org/genproto/googleapis/api/servicecontrol/v1,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_go_proto
58 google/api/servicecontrol/v1/metric_value.proto,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_proto,google.golang.org/genproto/googleapis/api/servicecontrol/v1,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_go_proto
59 google/api/servicecontrol/v1/operation.proto,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_proto,google.golang.org/genproto/googleapis/api/servicecontrol/v1,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_go_proto
60 google/api/servicecontrol/v1/quota_controller.proto,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_proto,google.golang.org/genproto/googleapis/api/servicecontrol/v1,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_go_proto
61 google/api/servicecontrol/v1/service_controller.proto,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_proto,google.golang.org/genproto/googleapis/api/servicecontrol/v1,@go_googleapis//google/api/servicecontrol/v1:servicecontrol_go_proto
62 google/api/servicemanagement/v1/resources.proto,@go_googleapis//google/api/servicemanagement/v1:servicemanagement_proto,google.golang.org/genproto/googleapis/api/servicemanagement/v1,@go_googleapis//google/api/servicemanagement/v1:servicemanagement_go_proto
63 google/api/servicemanagement/v1/servicemanager.proto,@go_googleapis//google/api/servicemanagement/v1:servicemanagement_proto,google.golang.org/genproto/googleapis/api/servicemanagement/v1,@go_googleapis//google/api/servicemanagement/v1:servicemanagement_go_proto
64 google/api/source_info.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
65 google/api/system_parameter.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
66 google/api/usage.proto,@go_googleapis//google/api:serviceconfig_proto,google.golang.org/genproto/googleapis/api/serviceconfig,@go_googleapis//google/api:serviceconfig_go_proto
67 google/appengine/legacy/audit_data.proto,@go_googleapis//google/appengine/legacy:legacy_proto,google.golang.org/genproto/googleapis/appengine/legacy,@go_googleapis//google/appengine/legacy:legacy_go_proto
68 google/appengine/logging/v1/request_log.proto,@go_googleapis//google/appengine/logging/v1:logging_proto,google.golang.org/genproto/googleapis/appengine/logging/v1,@go_googleapis//google/appengine/logging/v1:logging_go_proto
69 google/appengine/v1/app_yaml.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
70 google/appengine/v1/appengine.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
71 google/appengine/v1/application.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
72 google/appengine/v1/audit_data.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
73 google/appengine/v1/deploy.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
74 google/appengine/v1/instance.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
75 google/appengine/v1/location.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
76 google/appengine/v1/operation.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
77 google/appengine/v1/service.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
78 google/appengine/v1/version.proto,@go_googleapis//google/appengine/v1:appengine_proto,google.golang.org/genproto/googleapis/appengine/v1,@go_googleapis//google/appengine/v1:appengine_go_proto
79 google/assistant/embedded/v1alpha1/embedded_assistant.proto,@go_googleapis//google/assistant/embedded/v1alpha1:embedded_proto,google.golang.org/genproto/googleapis/assistant/embedded/v1alpha1,@go_googleapis//google/assistant/embedded/v1alpha1:embedded_go_proto
80 google/assistant/embedded/v1alpha2/embedded_assistant.proto,@go_googleapis//google/assistant/embedded/v1alpha2:embedded_proto,google.golang.org/genproto/googleapis/assistant/embedded/v1alpha2,@go_googleapis//google/assistant/embedded/v1alpha2:embedded_go_proto
81 google/bigtable/admin/cluster/v1/bigtable_cluster_data.proto,@go_googleapis//google/bigtable/admin/cluster/v1:cluster_proto,google.golang.org/genproto/googleapis/bigtable/admin/cluster/v1,@go_googleapis//google/bigtable/admin/cluster/v1:cluster_go_proto
82 google/bigtable/admin/cluster/v1/bigtable_cluster_service.proto,@go_googleapis//google/bigtable/admin/cluster/v1:cluster_proto,google.golang.org/genproto/googleapis/bigtable/admin/cluster/v1,@go_googleapis//google/bigtable/admin/cluster/v1:cluster_go_proto
83 google/bigtable/admin/cluster/v1/bigtable_cluster_service_messages.proto,@go_googleapis//google/bigtable/admin/cluster/v1:cluster_proto,google.golang.org/genproto/googleapis/bigtable/admin/cluster/v1,@go_googleapis//google/bigtable/admin/cluster/v1:cluster_go_proto
84 google/bigtable/admin/table/v1/bigtable_table_data.proto,@go_googleapis//google/bigtable/admin/table/v1:table_proto,google.golang.org/genproto/googleapis/bigtable/admin/table/v1,@go_googleapis//google/bigtable/admin/table/v1:table_go_proto
85 google/bigtable/admin/table/v1/bigtable_table_service.proto,@go_googleapis//google/bigtable/admin/table/v1:table_proto,google.golang.org/genproto/googleapis/bigtable/admin/table/v1,@go_googleapis//google/bigtable/admin/table/v1:table_go_proto
86 google/bigtable/admin/table/v1/bigtable_table_service_messages.proto,@go_googleapis//google/bigtable/admin/table/v1:table_proto,google.golang.org/genproto/googleapis/bigtable/admin/table/v1,@go_googleapis//google/bigtable/admin/table/v1:table_go_proto
87 google/bigtable/admin/v2/bigtable_instance_admin.proto,@go_googleapis//google/bigtable/admin/v2:admin_proto,google.golang.org/genproto/googleapis/bigtable/admin/v2,@go_googleapis//google/bigtable/admin/v2:admin_go_proto
88 google/bigtable/admin/v2/bigtable_table_admin.proto,@go_googleapis//google/bigtable/admin/v2:admin_proto,google.golang.org/genproto/googleapis/bigtable/admin/v2,@go_googleapis//google/bigtable/admin/v2:admin_go_proto
89 google/bigtable/admin/v2/common.proto,@go_googleapis//google/bigtable/admin/v2:admin_proto,google.golang.org/genproto/googleapis/bigtable/admin/v2,@go_googleapis//google/bigtable/admin/v2:admin_go_proto
90 google/bigtable/admin/v2/instance.proto,@go_googleapis//google/bigtable/admin/v2:admin_proto,google.golang.org/genproto/googleapis/bigtable/admin/v2,@go_googleapis//google/bigtable/admin/v2:admin_go_proto
91 google/bigtable/admin/v2/table.proto,@go_googleapis//google/bigtable/admin/v2:admin_proto,google.golang.org/genproto/googleapis/bigtable/admin/v2,@go_googleapis//google/bigtable/admin/v2:admin_go_proto
92 google/bigtable/v1/bigtable_data.proto,@go_googleapis//google/bigtable/v1:bigtable_proto,google.golang.org/genproto/googleapis/bigtable/v1,@go_googleapis//google/bigtable/v1:bigtable_go_proto
93 google/bigtable/v1/bigtable_service.proto,@go_googleapis//google/bigtable/v1:bigtable_proto,google.golang.org/genproto/googleapis/bigtable/v1,@go_googleapis//google/bigtable/v1:bigtable_go_proto
94 google/bigtable/v1/bigtable_service_messages.proto,@go_googleapis//google/bigtable/v1:bigtable_proto,google.golang.org/genproto/googleapis/bigtable/v1,@go_googleapis//google/bigtable/v1:bigtable_go_proto
95 google/bigtable/v2/bigtable.proto,@go_googleapis//google/bigtable/v2:bigtable_proto,google.golang.org/genproto/googleapis/bigtable/v2,@go_googleapis//google/bigtable/v2:bigtable_go_proto
96 google/bigtable/v2/data.proto,@go_googleapis//google/bigtable/v2:bigtable_proto,google.golang.org/genproto/googleapis/bigtable/v2,@go_googleapis//google/bigtable/v2:bigtable_go_proto
97 google/bytestream/bytestream.proto,@go_googleapis//google/bytestream:bytestream_proto,google.golang.org/genproto/googleapis/bytestream,@go_googleapis//google/bytestream:bytestream_go_proto
98 google/cloud/asset/v1beta1/asset_service.proto,@go_googleapis//google/cloud/asset/v1beta1:asset_proto,google.golang.org/genproto/googleapis/cloud/asset/v1beta1,@go_googleapis//google/cloud/asset/v1beta1:asset_go_proto
99 google/cloud/asset/v1beta1/assets.proto,@go_googleapis//google/cloud/asset/v1beta1:asset_proto,google.golang.org/genproto/googleapis/cloud/asset/v1beta1,@go_googleapis//google/cloud/asset/v1beta1:asset_go_proto
100 google/cloud/audit/audit_log.proto,@go_googleapis//google/cloud/audit:audit_proto,google.golang.org/genproto/googleapis/cloud/audit,@go_googleapis//google/cloud/audit:audit_go_proto
101 google/cloud/automl/v1beta1/annotation_payload.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
102 google/cloud/automl/v1beta1/classification.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
103 google/cloud/automl/v1beta1/data_items.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
104 google/cloud/automl/v1beta1/dataset.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
105 google/cloud/automl/v1beta1/image.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
106 google/cloud/automl/v1beta1/io.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
107 google/cloud/automl/v1beta1/model.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
108 google/cloud/automl/v1beta1/model_evaluation.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
109 google/cloud/automl/v1beta1/operations.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
110 google/cloud/automl/v1beta1/prediction_service.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
111 google/cloud/automl/v1beta1/service.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
112 google/cloud/automl/v1beta1/text.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
113 google/cloud/automl/v1beta1/translation.proto,@go_googleapis//google/cloud/automl/v1beta1:automl_proto,google.golang.org/genproto/googleapis/cloud/automl/v1beta1,@go_googleapis//google/cloud/automl/v1beta1:automl_go_proto
114 google/cloud/bigquery/datatransfer/v1/datatransfer.proto,@go_googleapis//google/cloud/bigquery/datatransfer/v1:datatransfer_proto,google.golang.org/genproto/googleapis/cloud/bigquery/datatransfer/v1,@go_googleapis//google/cloud/bigquery/datatransfer/v1:datatransfer_go_proto
115 google/cloud/bigquery/datatransfer/v1/transfer.proto,@go_googleapis//google/cloud/bigquery/datatransfer/v1:datatransfer_proto,google.golang.org/genproto/googleapis/cloud/bigquery/datatransfer/v1,@go_googleapis//google/cloud/bigquery/datatransfer/v1:datatransfer_go_proto
116 google/cloud/bigquery/logging/v1/audit_data.proto,@go_googleapis//google/cloud/bigquery/logging/v1:logging_proto,google.golang.org/genproto/googleapis/cloud/bigquery/logging/v1,@go_googleapis//google/cloud/bigquery/logging/v1:logging_go_proto
117 google/cloud/bigquery/storage/v1beta1/avro.proto,@go_googleapis//google/cloud/bigquery/storage/v1beta1:storage_proto,google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1,@go_googleapis//google/cloud/bigquery/storage/v1beta1:storage_go_proto
118 google/cloud/bigquery/storage/v1beta1/read_options.proto,@go_googleapis//google/cloud/bigquery/storage/v1beta1:storage_proto,google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1,@go_googleapis//google/cloud/bigquery/storage/v1beta1:storage_go_proto
119 google/cloud/bigquery/storage/v1beta1/storage.proto,@go_googleapis//google/cloud/bigquery/storage/v1beta1:storage_proto,google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1,@go_googleapis//google/cloud/bigquery/storage/v1beta1:storage_go_proto
120 google/cloud/bigquery/storage/v1beta1/table_reference.proto,@go_googleapis//google/cloud/bigquery/storage/v1beta1:storage_proto,google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1,@go_googleapis//google/cloud/bigquery/storage/v1beta1:storage_go_proto
121 google/cloud/billing/v1/cloud_billing.proto,@go_googleapis//google/cloud/billing/v1:billing_proto,google.golang.org/genproto/googleapis/cloud/billing/v1,@go_googleapis//google/cloud/billing/v1:billing_go_proto
122 google/cloud/dataproc/v1/clusters.proto,@go_googleapis//google/cloud/dataproc/v1:dataproc_proto,google.golang.org/genproto/googleapis/cloud/dataproc/v1,@go_googleapis//google/cloud/dataproc/v1:dataproc_go_proto
123 google/cloud/dataproc/v1/jobs.proto,@go_googleapis//google/cloud/dataproc/v1:dataproc_proto,google.golang.org/genproto/googleapis/cloud/dataproc/v1,@go_googleapis//google/cloud/dataproc/v1:dataproc_go_proto
124 google/cloud/dataproc/v1/operations.proto,@go_googleapis//google/cloud/dataproc/v1:dataproc_proto,google.golang.org/genproto/googleapis/cloud/dataproc/v1,@go_googleapis//google/cloud/dataproc/v1:dataproc_go_proto
125 google/cloud/dataproc/v1beta2/clusters.proto,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_proto,google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_go_proto
126 google/cloud/dataproc/v1beta2/jobs.proto,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_proto,google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_go_proto
127 google/cloud/dataproc/v1beta2/operations.proto,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_proto,google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_go_proto
128 google/cloud/dataproc/v1beta2/shared.proto,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_proto,google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_go_proto
129 google/cloud/dataproc/v1beta2/workflow_templates.proto,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_proto,google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2,@go_googleapis//google/cloud/dataproc/v1beta2:dataproc_go_proto
130 google/cloud/dialogflow/v2/agent.proto,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_go_proto
131 google/cloud/dialogflow/v2/context.proto,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_go_proto
132 google/cloud/dialogflow/v2/entity_type.proto,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_go_proto
133 google/cloud/dialogflow/v2/intent.proto,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_go_proto
134 google/cloud/dialogflow/v2/session.proto,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_go_proto
135 google/cloud/dialogflow/v2/session_entity_type.proto,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_go_proto
136 google/cloud/dialogflow/v2/webhook.proto,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2,@go_googleapis//google/cloud/dialogflow/v2:dialogflow_go_proto
137 google/cloud/dialogflow/v2beta1/agent.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
138 google/cloud/dialogflow/v2beta1/audio_config.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
139 google/cloud/dialogflow/v2beta1/context.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
140 google/cloud/dialogflow/v2beta1/document.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
141 google/cloud/dialogflow/v2beta1/entity_type.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
142 google/cloud/dialogflow/v2beta1/intent.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
143 google/cloud/dialogflow/v2beta1/knowledge_base.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
144 google/cloud/dialogflow/v2beta1/session.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
145 google/cloud/dialogflow/v2beta1/session_entity_type.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
146 google/cloud/dialogflow/v2beta1/webhook.proto,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_proto,google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1,@go_googleapis//google/cloud/dialogflow/v2beta1:dialogflow_go_proto
147 google/cloud/functions/v1beta2/functions.proto,@go_googleapis//google/cloud/functions/v1beta2:functions_proto,google.golang.org/genproto/googleapis/cloud/functions/v1beta2,@go_googleapis//google/cloud/functions/v1beta2:functions_go_proto
148 google/cloud/functions/v1beta2/operations.proto,@go_googleapis//google/cloud/functions/v1beta2:functions_proto,google.golang.org/genproto/googleapis/cloud/functions/v1beta2,@go_googleapis//google/cloud/functions/v1beta2:functions_go_proto
149 google/cloud/iot/v1/device_manager.proto,@go_googleapis//google/cloud/iot/v1:iot_proto,google.golang.org/genproto/googleapis/cloud/iot/v1,@go_googleapis//google/cloud/iot/v1:iot_go_proto
150 google/cloud/iot/v1/resources.proto,@go_googleapis//google/cloud/iot/v1:iot_proto,google.golang.org/genproto/googleapis/cloud/iot/v1,@go_googleapis//google/cloud/iot/v1:iot_go_proto
151 google/cloud/kms/v1/resources.proto,@go_googleapis//google/cloud/kms/v1:kms_proto,google.golang.org/genproto/googleapis/cloud/kms/v1,@go_googleapis//google/cloud/kms/v1:kms_go_proto
152 google/cloud/kms/v1/service.proto,@go_googleapis//google/cloud/kms/v1:kms_proto,google.golang.org/genproto/googleapis/cloud/kms/v1,@go_googleapis//google/cloud/kms/v1:kms_go_proto
153 google/cloud/language/v1/language_service.proto,@go_googleapis//google/cloud/language/v1:language_proto,google.golang.org/genproto/googleapis/cloud/language/v1,@go_googleapis//google/cloud/language/v1:language_go_proto
154 google/cloud/language/v1beta1/language_service.proto,@go_googleapis//google/cloud/language/v1beta1:language_proto,google.golang.org/genproto/googleapis/cloud/language/v1beta1,@go_googleapis//google/cloud/language/v1beta1:language_go_proto
155 google/cloud/language/v1beta2/language_service.proto,@go_googleapis//google/cloud/language/v1beta2:language_proto,google.golang.org/genproto/googleapis/cloud/language/v1beta2,@go_googleapis//google/cloud/language/v1beta2:language_go_proto
156 google/cloud/location/locations.proto,@go_googleapis//google/cloud/location:location_proto,google.golang.org/genproto/googleapis/cloud/location,@go_googleapis//google/cloud/location:location_go_proto
157 google/cloud/ml/v1/job_service.proto,@go_googleapis//google/cloud/ml/v1:ml_proto,google.golang.org/genproto/googleapis/cloud/ml/v1,@go_googleapis//google/cloud/ml/v1:ml_go_proto
158 google/cloud/ml/v1/model_service.proto,@go_googleapis//google/cloud/ml/v1:ml_proto,google.golang.org/genproto/googleapis/cloud/ml/v1,@go_googleapis//google/cloud/ml/v1:ml_go_proto
159 google/cloud/ml/v1/operation_metadata.proto,@go_googleapis//google/cloud/ml/v1:ml_proto,google.golang.org/genproto/googleapis/cloud/ml/v1,@go_googleapis//google/cloud/ml/v1:ml_go_proto
160 google/cloud/ml/v1/prediction_service.proto,@go_googleapis//google/cloud/ml/v1:ml_proto,google.golang.org/genproto/googleapis/cloud/ml/v1,@go_googleapis//google/cloud/ml/v1:ml_go_proto
161 google/cloud/ml/v1/project_service.proto,@go_googleapis//google/cloud/ml/v1:ml_proto,google.golang.org/genproto/googleapis/cloud/ml/v1,@go_googleapis//google/cloud/ml/v1:ml_go_proto
162 google/cloud/oslogin/common/common.proto,@go_googleapis//google/cloud/oslogin/common:common_proto,google.golang.org/genproto/googleapis/cloud/oslogin/common,@go_googleapis//google/cloud/oslogin/common:common_go_proto
163 google/cloud/oslogin/v1/oslogin.proto,@go_googleapis//google/cloud/oslogin/v1:oslogin_proto,google.golang.org/genproto/googleapis/cloud/oslogin/v1,@go_googleapis//google/cloud/oslogin/v1:oslogin_go_proto
164 google/cloud/oslogin/v1alpha/oslogin.proto,@go_googleapis//google/cloud/oslogin/v1alpha:oslogin_proto,google.golang.org/genproto/googleapis/cloud/oslogin/v1alpha,@go_googleapis//google/cloud/oslogin/v1alpha:oslogin_go_proto
165 google/cloud/oslogin/v1beta/oslogin.proto,@go_googleapis//google/cloud/oslogin/v1beta:oslogin_proto,google.golang.org/genproto/googleapis/cloud/oslogin/v1beta,@go_googleapis//google/cloud/oslogin/v1beta:oslogin_go_proto
166 google/cloud/redis/v1/cloud_redis.proto,@go_googleapis//google/cloud/redis/v1:redis_proto,google.golang.org/genproto/googleapis/cloud/redis/v1,@go_googleapis//google/cloud/redis/v1:redis_go_proto
167 google/cloud/redis/v1beta1/cloud_redis.proto,@go_googleapis//google/cloud/redis/v1beta1:redis_proto,google.golang.org/genproto/googleapis/cloud/redis/v1beta1,@go_googleapis//google/cloud/redis/v1beta1:redis_go_proto
168 google/cloud/resourcemanager/v2/folders.proto,@go_googleapis//google/cloud/resourcemanager/v2:resourcemanager_proto,google.golang.org/genproto/googleapis/cloud/resourcemanager/v2,@go_googleapis//google/cloud/resourcemanager/v2:resourcemanager_go_proto
169 google/cloud/runtimeconfig/v1beta1/resources.proto,@go_googleapis//google/cloud/runtimeconfig/v1beta1:runtimeconfig_proto,google.golang.org/genproto/googleapis/cloud/runtimeconfig/v1beta1,@go_googleapis//google/cloud/runtimeconfig/v1beta1:runtimeconfig_go_proto
170 google/cloud/runtimeconfig/v1beta1/runtimeconfig.proto,@go_googleapis//google/cloud/runtimeconfig/v1beta1:runtimeconfig_proto,google.golang.org/genproto/googleapis/cloud/runtimeconfig/v1beta1,@go_googleapis//google/cloud/runtimeconfig/v1beta1:runtimeconfig_go_proto
171 google/cloud/speech/v1/cloud_speech.proto,@go_googleapis//google/cloud/speech/v1:speech_proto,google.golang.org/genproto/googleapis/cloud/speech/v1,@go_googleapis//google/cloud/speech/v1:speech_go_proto
172 google/cloud/speech/v1p1beta1/cloud_speech.proto,@go_googleapis//google/cloud/speech/v1p1beta1:speech_proto,google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1,@go_googleapis//google/cloud/speech/v1p1beta1:speech_go_proto
173 google/cloud/support/common.proto,@go_googleapis//google/cloud/support:common_proto,google.golang.org/genproto/googleapis/cloud/support/common,@go_googleapis//google/cloud/support:common_go_proto
174 google/cloud/support/v1alpha1/cloud_support.proto,@go_googleapis//google/cloud/support/v1alpha1:support_proto,google.golang.org/genproto/googleapis/cloud/support/v1alpha1,@go_googleapis//google/cloud/support/v1alpha1:support_go_proto
175 google/cloud/tasks/v2beta2/cloudtasks.proto,@go_googleapis//google/cloud/tasks/v2beta2:tasks_proto,google.golang.org/genproto/googleapis/cloud/tasks/v2beta2,@go_googleapis//google/cloud/tasks/v2beta2:tasks_go_proto
176 google/cloud/tasks/v2beta2/queue.proto,@go_googleapis//google/cloud/tasks/v2beta2:tasks_proto,google.golang.org/genproto/googleapis/cloud/tasks/v2beta2,@go_googleapis//google/cloud/tasks/v2beta2:tasks_go_proto
177 google/cloud/tasks/v2beta2/target.proto,@go_googleapis//google/cloud/tasks/v2beta2:tasks_proto,google.golang.org/genproto/googleapis/cloud/tasks/v2beta2,@go_googleapis//google/cloud/tasks/v2beta2:tasks_go_proto
178 google/cloud/tasks/v2beta2/task.proto,@go_googleapis//google/cloud/tasks/v2beta2:tasks_proto,google.golang.org/genproto/googleapis/cloud/tasks/v2beta2,@go_googleapis//google/cloud/tasks/v2beta2:tasks_go_proto
179 google/cloud/tasks/v2beta3/cloudtasks.proto,@go_googleapis//google/cloud/tasks/v2beta3:tasks_proto,google.golang.org/genproto/googleapis/cloud/tasks/v2beta3,@go_googleapis//google/cloud/tasks/v2beta3:tasks_go_proto
180 google/cloud/tasks/v2beta3/queue.proto,@go_googleapis//google/cloud/tasks/v2beta3:tasks_proto,google.golang.org/genproto/googleapis/cloud/tasks/v2beta3,@go_googleapis//google/cloud/tasks/v2beta3:tasks_go_proto
181 google/cloud/tasks/v2beta3/target.proto,@go_googleapis//google/cloud/tasks/v2beta3:tasks_proto,google.golang.org/genproto/googleapis/cloud/tasks/v2beta3,@go_googleapis//google/cloud/tasks/v2beta3:tasks_go_proto
182 google/cloud/tasks/v2beta3/task.proto,@go_googleapis//google/cloud/tasks/v2beta3:tasks_proto,google.golang.org/genproto/googleapis/cloud/tasks/v2beta3,@go_googleapis//google/cloud/tasks/v2beta3:tasks_go_proto
183 google/cloud/texttospeech/v1/cloud_tts.proto,@go_googleapis//google/cloud/texttospeech/v1:texttospeech_proto,google.golang.org/genproto/googleapis/cloud/texttospeech/v1,@go_googleapis//google/cloud/texttospeech/v1:texttospeech_go_proto
184 google/cloud/texttospeech/v1beta1/cloud_tts.proto,@go_googleapis//google/cloud/texttospeech/v1beta1:texttospeech_proto,google.golang.org/genproto/googleapis/cloud/texttospeech/v1beta1,@go_googleapis//google/cloud/texttospeech/v1beta1:texttospeech_go_proto
185 google/cloud/videointelligence/v1/video_intelligence.proto,@go_googleapis//google/cloud/videointelligence/v1:videointelligence_proto,google.golang.org/genproto/googleapis/cloud/videointelligence/v1,@go_googleapis//google/cloud/videointelligence/v1:videointelligence_go_proto
186 google/cloud/videointelligence/v1beta1/video_intelligence.proto,@go_googleapis//google/cloud/videointelligence/v1beta1:videointelligence_proto,google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta1,@go_googleapis//google/cloud/videointelligence/v1beta1:videointelligence_go_proto
187 google/cloud/videointelligence/v1beta2/video_intelligence.proto,@go_googleapis//google/cloud/videointelligence/v1beta2:videointelligence_proto,google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta2,@go_googleapis//google/cloud/videointelligence/v1beta2:videointelligence_go_proto
188 google/cloud/videointelligence/v1p1beta1/video_intelligence.proto,@go_googleapis//google/cloud/videointelligence/v1p1beta1:videointelligence_proto,google.golang.org/genproto/googleapis/cloud/videointelligence/v1p1beta1,@go_googleapis//google/cloud/videointelligence/v1p1beta1:videointelligence_go_proto
189 google/cloud/videointelligence/v1p2beta1/video_intelligence.proto,@go_googleapis//google/cloud/videointelligence/v1p2beta1:videointelligence_proto,google.golang.org/genproto/googleapis/cloud/videointelligence/v1p2beta1,@go_googleapis//google/cloud/videointelligence/v1p2beta1:videointelligence_go_proto
190 google/cloud/vision/v1/geometry.proto,@go_googleapis//google/cloud/vision/v1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1,@go_googleapis//google/cloud/vision/v1:vision_go_proto
191 google/cloud/vision/v1/image_annotator.proto,@go_googleapis//google/cloud/vision/v1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1,@go_googleapis//google/cloud/vision/v1:vision_go_proto
192 google/cloud/vision/v1/text_annotation.proto,@go_googleapis//google/cloud/vision/v1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1,@go_googleapis//google/cloud/vision/v1:vision_go_proto
193 google/cloud/vision/v1/web_detection.proto,@go_googleapis//google/cloud/vision/v1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1,@go_googleapis//google/cloud/vision/v1:vision_go_proto
194 google/cloud/vision/v1p1beta1/geometry.proto,@go_googleapis//google/cloud/vision/v1p1beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1,@go_googleapis//google/cloud/vision/v1p1beta1:vision_go_proto
195 google/cloud/vision/v1p1beta1/image_annotator.proto,@go_googleapis//google/cloud/vision/v1p1beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1,@go_googleapis//google/cloud/vision/v1p1beta1:vision_go_proto
196 google/cloud/vision/v1p1beta1/text_annotation.proto,@go_googleapis//google/cloud/vision/v1p1beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1,@go_googleapis//google/cloud/vision/v1p1beta1:vision_go_proto
197 google/cloud/vision/v1p1beta1/web_detection.proto,@go_googleapis//google/cloud/vision/v1p1beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1,@go_googleapis//google/cloud/vision/v1p1beta1:vision_go_proto
198 google/cloud/vision/v1p2beta1/geometry.proto,@go_googleapis//google/cloud/vision/v1p2beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1,@go_googleapis//google/cloud/vision/v1p2beta1:vision_go_proto
199 google/cloud/vision/v1p2beta1/image_annotator.proto,@go_googleapis//google/cloud/vision/v1p2beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1,@go_googleapis//google/cloud/vision/v1p2beta1:vision_go_proto
200 google/cloud/vision/v1p2beta1/text_annotation.proto,@go_googleapis//google/cloud/vision/v1p2beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1,@go_googleapis//google/cloud/vision/v1p2beta1:vision_go_proto
201 google/cloud/vision/v1p2beta1/web_detection.proto,@go_googleapis//google/cloud/vision/v1p2beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1,@go_googleapis//google/cloud/vision/v1p2beta1:vision_go_proto
202 google/cloud/vision/v1p3beta1/geometry.proto,@go_googleapis//google/cloud/vision/v1p3beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1,@go_googleapis//google/cloud/vision/v1p3beta1:vision_go_proto
203 google/cloud/vision/v1p3beta1/image_annotator.proto,@go_googleapis//google/cloud/vision/v1p3beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1,@go_googleapis//google/cloud/vision/v1p3beta1:vision_go_proto
204 google/cloud/vision/v1p3beta1/product_search.proto,@go_googleapis//google/cloud/vision/v1p3beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1,@go_googleapis//google/cloud/vision/v1p3beta1:vision_go_proto
205 google/cloud/vision/v1p3beta1/product_search_service.proto,@go_googleapis//google/cloud/vision/v1p3beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1,@go_googleapis//google/cloud/vision/v1p3beta1:vision_go_proto
206 google/cloud/vision/v1p3beta1/text_annotation.proto,@go_googleapis//google/cloud/vision/v1p3beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1,@go_googleapis//google/cloud/vision/v1p3beta1:vision_go_proto
207 google/cloud/vision/v1p3beta1/web_detection.proto,@go_googleapis//google/cloud/vision/v1p3beta1:vision_proto,google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1,@go_googleapis//google/cloud/vision/v1p3beta1:vision_go_proto
208 google/cloud/websecurityscanner/v1alpha/crawled_url.proto,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_proto,google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_go_proto
209 google/cloud/websecurityscanner/v1alpha/finding.proto,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_proto,google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_go_proto
210 google/cloud/websecurityscanner/v1alpha/finding_addon.proto,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_proto,google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_go_proto
211 google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_proto,google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_go_proto
212 google/cloud/websecurityscanner/v1alpha/scan_config.proto,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_proto,google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_go_proto
213 google/cloud/websecurityscanner/v1alpha/scan_run.proto,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_proto,google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_go_proto
214 google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_proto,google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha,@go_googleapis//google/cloud/websecurityscanner/v1alpha:websecurityscanner_go_proto
215 google/container/v1/cluster_service.proto,@go_googleapis//google/container/v1:container_proto,google.golang.org/genproto/googleapis/container/v1,@go_googleapis//google/container/v1:container_go_proto
216 google/container/v1alpha1/cluster_service.proto,@go_googleapis//google/container/v1alpha1:container_proto,google.golang.org/genproto/googleapis/container/v1alpha1,@go_googleapis//google/container/v1alpha1:container_go_proto
217 google/container/v1beta1/cluster_service.proto,@go_googleapis//google/container/v1beta1:container_proto,google.golang.org/genproto/googleapis/container/v1beta1,@go_googleapis//google/container/v1beta1:container_go_proto
218 google/datastore/admin/v1/datastore_admin.proto,@go_googleapis//google/datastore/admin/v1:admin_proto,google.golang.org/genproto/googleapis/datastore/admin/v1,@go_googleapis//google/datastore/admin/v1:admin_go_proto
219 google/datastore/admin/v1/index.proto,@go_googleapis//google/datastore/admin/v1:admin_proto,google.golang.org/genproto/googleapis/datastore/admin/v1,@go_googleapis//google/datastore/admin/v1:admin_go_proto
220 google/datastore/admin/v1beta1/datastore_admin.proto,@go_googleapis//google/datastore/admin/v1beta1:admin_proto,google.golang.org/genproto/googleapis/datastore/admin/v1beta1,@go_googleapis//google/datastore/admin/v1beta1:admin_go_proto
221 google/datastore/v1/datastore.proto,@go_googleapis//google/datastore/v1:datastore_proto,google.golang.org/genproto/googleapis/datastore/v1,@go_googleapis//google/datastore/v1:datastore_go_proto
222 google/datastore/v1/entity.proto,@go_googleapis//google/datastore/v1:datastore_proto,google.golang.org/genproto/googleapis/datastore/v1,@go_googleapis//google/datastore/v1:datastore_go_proto
223 google/datastore/v1/query.proto,@go_googleapis//google/datastore/v1:datastore_proto,google.golang.org/genproto/googleapis/datastore/v1,@go_googleapis//google/datastore/v1:datastore_go_proto
224 google/datastore/v1beta3/datastore.proto,@go_googleapis//google/datastore/v1beta3:datastore_proto,google.golang.org/genproto/googleapis/datastore/v1beta3,@go_googleapis//google/datastore/v1beta3:datastore_go_proto
225 google/datastore/v1beta3/entity.proto,@go_googleapis//google/datastore/v1beta3:datastore_proto,google.golang.org/genproto/googleapis/datastore/v1beta3,@go_googleapis//google/datastore/v1beta3:datastore_go_proto
226 google/datastore/v1beta3/query.proto,@go_googleapis//google/datastore/v1beta3:datastore_proto,google.golang.org/genproto/googleapis/datastore/v1beta3,@go_googleapis//google/datastore/v1beta3:datastore_go_proto
227 google/devtools/build/v1/build_events.proto,@go_googleapis//google/devtools/build/v1:build_proto,google.golang.org/genproto/googleapis/devtools/build/v1,@go_googleapis//google/devtools/build/v1:build_go_proto
228 google/devtools/build/v1/build_status.proto,@go_googleapis//google/devtools/build/v1:build_proto,google.golang.org/genproto/googleapis/devtools/build/v1,@go_googleapis//google/devtools/build/v1:build_go_proto
229 google/devtools/build/v1/publish_build_event.proto,@go_googleapis//google/devtools/build/v1:build_proto,google.golang.org/genproto/googleapis/devtools/build/v1,@go_googleapis//google/devtools/build/v1:build_go_proto
230 google/devtools/cloudbuild/v1/cloudbuild.proto,@go_googleapis//google/devtools/cloudbuild/v1:cloudbuild_proto,google.golang.org/genproto/googleapis/devtools/cloudbuild/v1,@go_googleapis//google/devtools/cloudbuild/v1:cloudbuild_go_proto
231 google/devtools/clouddebugger/v2/controller.proto,@go_googleapis//google/devtools/clouddebugger/v2:clouddebugger_proto,google.golang.org/genproto/googleapis/devtools/clouddebugger/v2,@go_googleapis//google/devtools/clouddebugger/v2:clouddebugger_go_proto
232 google/devtools/clouddebugger/v2/data.proto,@go_googleapis//google/devtools/clouddebugger/v2:clouddebugger_proto,google.golang.org/genproto/googleapis/devtools/clouddebugger/v2,@go_googleapis//google/devtools/clouddebugger/v2:clouddebugger_go_proto
233 google/devtools/clouddebugger/v2/debugger.proto,@go_googleapis//google/devtools/clouddebugger/v2:clouddebugger_proto,google.golang.org/genproto/googleapis/devtools/clouddebugger/v2,@go_googleapis//google/devtools/clouddebugger/v2:clouddebugger_go_proto
234 google/devtools/clouderrorreporting/v1beta1/common.proto,@go_googleapis//google/devtools/clouderrorreporting/v1beta1:clouderrorreporting_proto,google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1,@go_googleapis//google/devtools/clouderrorreporting/v1beta1:clouderrorreporting_go_proto
235 google/devtools/clouderrorreporting/v1beta1/error_group_service.proto,@go_googleapis//google/devtools/clouderrorreporting/v1beta1:clouderrorreporting_proto,google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1,@go_googleapis//google/devtools/clouderrorreporting/v1beta1:clouderrorreporting_go_proto
236 google/devtools/clouderrorreporting/v1beta1/error_stats_service.proto,@go_googleapis//google/devtools/clouderrorreporting/v1beta1:clouderrorreporting_proto,google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1,@go_googleapis//google/devtools/clouderrorreporting/v1beta1:clouderrorreporting_go_proto
237 google/devtools/clouderrorreporting/v1beta1/report_errors_service.proto,@go_googleapis//google/devtools/clouderrorreporting/v1beta1:clouderrorreporting_proto,google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1,@go_googleapis//google/devtools/clouderrorreporting/v1beta1:clouderrorreporting_go_proto
238 google/devtools/cloudprofiler/v2/profiler.proto,@go_googleapis//google/devtools/cloudprofiler/v2:cloudprofiler_proto,google.golang.org/genproto/googleapis/devtools/cloudprofiler/v2,@go_googleapis//google/devtools/cloudprofiler/v2:cloudprofiler_go_proto
239 google/devtools/cloudtrace/v1/trace.proto,@go_googleapis//google/devtools/cloudtrace/v1:cloudtrace_proto,google.golang.org/genproto/googleapis/devtools/cloudtrace/v1,@go_googleapis//google/devtools/cloudtrace/v1:cloudtrace_go_proto
240 google/devtools/cloudtrace/v2/trace.proto,@go_googleapis//google/devtools/cloudtrace/v2:cloudtrace_proto,google.golang.org/genproto/googleapis/devtools/cloudtrace/v2,@go_googleapis//google/devtools/cloudtrace/v2:cloudtrace_go_proto
241 google/devtools/cloudtrace/v2/tracing.proto,@go_googleapis//google/devtools/cloudtrace/v2:cloudtrace_proto,google.golang.org/genproto/googleapis/devtools/cloudtrace/v2,@go_googleapis//google/devtools/cloudtrace/v2:cloudtrace_go_proto
242 google/devtools/containeranalysis/v1alpha1/bill_of_materials.proto,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1alpha1,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_go_proto
243 google/devtools/containeranalysis/v1alpha1/containeranalysis.proto,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1alpha1,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_go_proto
244 google/devtools/containeranalysis/v1alpha1/image_basis.proto,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1alpha1,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_go_proto
245 google/devtools/containeranalysis/v1alpha1/package_vulnerability.proto,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1alpha1,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_go_proto
246 google/devtools/containeranalysis/v1alpha1/provenance.proto,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1alpha1,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_go_proto
247 google/devtools/containeranalysis/v1alpha1/source_context.proto,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1alpha1,@go_googleapis//google/devtools/containeranalysis/v1alpha1:containeranalysis_go_proto
248 google/devtools/containeranalysis/v1beta1/attestation/attestation.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/attestation:attestation_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/attestation,@go_googleapis//google/devtools/containeranalysis/v1beta1/attestation:attestation_go_proto
249 google/devtools/containeranalysis/v1beta1/build/build.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/build:build_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/build,@go_googleapis//google/devtools/containeranalysis/v1beta1/build:build_go_proto
250 google/devtools/containeranalysis/v1beta1/common/common.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/common:common_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/common,@go_googleapis//google/devtools/containeranalysis/v1beta1/common:common_go_proto
251 google/devtools/containeranalysis/v1beta1/containeranalysis.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1:containeranalysis_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1,@go_googleapis//google/devtools/containeranalysis/v1beta1:containeranalysis_go_proto
252 google/devtools/containeranalysis/v1beta1/deployment/deployment.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/deployment:deployment_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/deployment,@go_googleapis//google/devtools/containeranalysis/v1beta1/deployment:deployment_go_proto
253 google/devtools/containeranalysis/v1beta1/discovery/discovery.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/discovery:discovery_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/discovery,@go_googleapis//google/devtools/containeranalysis/v1beta1/discovery:discovery_go_proto
254 google/devtools/containeranalysis/v1beta1/grafeas/grafeas.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/grafeas:grafeas_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas,@go_googleapis//google/devtools/containeranalysis/v1beta1/grafeas:grafeas_go_proto
255 google/devtools/containeranalysis/v1beta1/image/image.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/image:image_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/image,@go_googleapis//google/devtools/containeranalysis/v1beta1/image:image_go_proto
256 google/devtools/containeranalysis/v1beta1/package/package.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/package:package_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/package,@go_googleapis//google/devtools/containeranalysis/v1beta1/package:package_go_proto
257 google/devtools/containeranalysis/v1beta1/provenance/provenance.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/provenance:provenance_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/provenance,@go_googleapis//google/devtools/containeranalysis/v1beta1/provenance:provenance_go_proto
258 google/devtools/containeranalysis/v1beta1/source/source.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/source:source_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/source,@go_googleapis//google/devtools/containeranalysis/v1beta1/source:source_go_proto
259 google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto,@go_googleapis//google/devtools/containeranalysis/v1beta1/vulnerability:vulnerability_proto,google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/vulnerability,@go_googleapis//google/devtools/containeranalysis/v1beta1/vulnerability:vulnerability_go_proto
260 google/devtools/remoteexecution/v1test/remote_execution.proto,@go_googleapis//google/devtools/remoteexecution/v1test:remoteexecution_proto,google.golang.org/genproto/googleapis/devtools/remoteexecution/v1test,@go_googleapis//google/devtools/remoteexecution/v1test:remoteexecution_go_proto
261 google/devtools/remoteworkers/v1test2/bots.proto,@go_googleapis//google/devtools/remoteworkers/v1test2:remoteworkers_proto,google.golang.org/genproto/googleapis/devtools/remoteworkers/v1test2,@go_googleapis//google/devtools/remoteworkers/v1test2:remoteworkers_go_proto
262 google/devtools/remoteworkers/v1test2/command.proto,@go_googleapis//google/devtools/remoteworkers/v1test2:remoteworkers_proto,google.golang.org/genproto/googleapis/devtools/remoteworkers/v1test2,@go_googleapis//google/devtools/remoteworkers/v1test2:remoteworkers_go_proto
263 google/devtools/remoteworkers/v1test2/tasks.proto,@go_googleapis//google/devtools/remoteworkers/v1test2:remoteworkers_proto,google.golang.org/genproto/googleapis/devtools/remoteworkers/v1test2,@go_googleapis//google/devtools/remoteworkers/v1test2:remoteworkers_go_proto
264 google/devtools/remoteworkers/v1test2/worker.proto,@go_googleapis//google/devtools/remoteworkers/v1test2:remoteworkers_proto,google.golang.org/genproto/googleapis/devtools/remoteworkers/v1test2,@go_googleapis//google/devtools/remoteworkers/v1test2:remoteworkers_go_proto
265 google/devtools/resultstore/v2/action.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
266 google/devtools/resultstore/v2/common.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
267 google/devtools/resultstore/v2/configuration.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
268 google/devtools/resultstore/v2/configured_target.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
269 google/devtools/resultstore/v2/coverage.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
270 google/devtools/resultstore/v2/coverage_summary.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
271 google/devtools/resultstore/v2/file.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
272 google/devtools/resultstore/v2/file_set.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
273 google/devtools/resultstore/v2/invocation.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
274 google/devtools/resultstore/v2/resultstore_download.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
275 google/devtools/resultstore/v2/resultstore_file_download.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
276 google/devtools/resultstore/v2/target.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
277 google/devtools/resultstore/v2/test_suite.proto,@go_googleapis//google/devtools/resultstore/v2:resultstore_proto,google.golang.org/genproto/googleapis/devtools/resultstore/v2,@go_googleapis//google/devtools/resultstore/v2:resultstore_go_proto
278 google/devtools/source/v1/source_context.proto,@go_googleapis//google/devtools/source/v1:source_proto,google.golang.org/genproto/googleapis/devtools/source/v1,@go_googleapis//google/devtools/source/v1:source_go_proto
279 google/devtools/sourcerepo/v1/sourcerepo.proto,@go_googleapis//google/devtools/sourcerepo/v1:sourcerepo_proto,google.golang.org/genproto/googleapis/devtools/sourcerepo/v1,@go_googleapis//google/devtools/sourcerepo/v1:sourcerepo_go_proto
280 google/example/library/v1/library.proto,@go_googleapis//google/example/library/v1:library_proto,google.golang.org/genproto/googleapis/example/library/v1,@go_googleapis//google/example/library/v1:library_go_proto
281 google/firestore/admin/v1beta1/firestore_admin.proto,@go_googleapis//google/firestore/admin/v1beta1:admin_proto,google.golang.org/genproto/googleapis/firestore/admin/v1beta1,@go_googleapis//google/firestore/admin/v1beta1:admin_go_proto
282 google/firestore/admin/v1beta1/index.proto,@go_googleapis//google/firestore/admin/v1beta1:admin_proto,google.golang.org/genproto/googleapis/firestore/admin/v1beta1,@go_googleapis//google/firestore/admin/v1beta1:admin_go_proto
283 google/firestore/admin/v1beta2/field.proto,@go_googleapis//google/firestore/admin/v1beta2:admin_proto,google.golang.org/genproto/googleapis/firestore/admin/v1beta2,@go_googleapis//google/firestore/admin/v1beta2:admin_go_proto
284 google/firestore/admin/v1beta2/firestore_admin.proto,@go_googleapis//google/firestore/admin/v1beta2:admin_proto,google.golang.org/genproto/googleapis/firestore/admin/v1beta2,@go_googleapis//google/firestore/admin/v1beta2:admin_go_proto
285 google/firestore/admin/v1beta2/index.proto,@go_googleapis//google/firestore/admin/v1beta2:admin_proto,google.golang.org/genproto/googleapis/firestore/admin/v1beta2,@go_googleapis//google/firestore/admin/v1beta2:admin_go_proto
286 google/firestore/admin/v1beta2/operation.proto,@go_googleapis//google/firestore/admin/v1beta2:admin_proto,google.golang.org/genproto/googleapis/firestore/admin/v1beta2,@go_googleapis//google/firestore/admin/v1beta2:admin_go_proto
287 google/firestore/v1beta1/common.proto,@go_googleapis//google/firestore/v1beta1:firestore_proto,google.golang.org/genproto/googleapis/firestore/v1beta1,@go_googleapis//google/firestore/v1beta1:firestore_go_proto
288 google/firestore/v1beta1/document.proto,@go_googleapis//google/firestore/v1beta1:firestore_proto,google.golang.org/genproto/googleapis/firestore/v1beta1,@go_googleapis//google/firestore/v1beta1:firestore_go_proto
289 google/firestore/v1beta1/firestore.proto,@go_googleapis//google/firestore/v1beta1:firestore_proto,google.golang.org/genproto/googleapis/firestore/v1beta1,@go_googleapis//google/firestore/v1beta1:firestore_go_proto
290 google/firestore/v1beta1/query.proto,@go_googleapis//google/firestore/v1beta1:firestore_proto,google.golang.org/genproto/googleapis/firestore/v1beta1,@go_googleapis//google/firestore/v1beta1:firestore_go_proto
291 google/firestore/v1beta1/write.proto,@go_googleapis//google/firestore/v1beta1:firestore_proto,google.golang.org/genproto/googleapis/firestore/v1beta1,@go_googleapis//google/firestore/v1beta1:firestore_go_proto
292 google/genomics/v1/annotations.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
293 google/genomics/v1/cigar.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
294 google/genomics/v1/datasets.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
295 google/genomics/v1/operations.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
296 google/genomics/v1/position.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
297 google/genomics/v1/range.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
298 google/genomics/v1/readalignment.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
299 google/genomics/v1/readgroup.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
300 google/genomics/v1/readgroupset.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
301 google/genomics/v1/reads.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
302 google/genomics/v1/references.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
303 google/genomics/v1/variants.proto,@go_googleapis//google/genomics/v1:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1,@go_googleapis//google/genomics/v1:genomics_go_proto
304 google/genomics/v1alpha2/pipelines.proto,@go_googleapis//google/genomics/v1alpha2:genomics_proto,google.golang.org/genproto/googleapis/genomics/v1alpha2,@go_googleapis//google/genomics/v1alpha2:genomics_go_proto
305 google/home/graph/v1/device.proto,@go_googleapis//google/home/graph/v1:graph_proto,google.golang.org/genproto/googleapis/home/graph/v1,@go_googleapis//google/home/graph/v1:graph_go_proto
306 google/home/graph/v1/homegraph.proto,@go_googleapis//google/home/graph/v1:graph_proto,google.golang.org/genproto/googleapis/home/graph/v1,@go_googleapis//google/home/graph/v1:graph_go_proto
307 google/iam/admin/v1/iam.proto,@go_googleapis//google/iam/admin/v1:admin_proto,google.golang.org/genproto/googleapis/iam/admin/v1,@go_googleapis//google/iam/admin/v1:admin_go_proto
308 google/iam/credentials/v1/common.proto,@go_googleapis//google/iam/credentials/v1:credentials_proto,google.golang.org/genproto/googleapis/iam/credentials/v1,@go_googleapis//google/iam/credentials/v1:credentials_go_proto
309 google/iam/credentials/v1/iamcredentials.proto,@go_googleapis//google/iam/credentials/v1:credentials_proto,google.golang.org/genproto/googleapis/iam/credentials/v1,@go_googleapis//google/iam/credentials/v1:credentials_go_proto
310 google/iam/v1/iam_policy.proto,@go_googleapis//google/iam/v1:iam_proto,google.golang.org/genproto/googleapis/iam/v1,@go_googleapis//google/iam/v1:iam_go_proto
311 google/iam/v1/logging/audit_data.proto,@go_googleapis//google/iam/v1/logging:logging_proto,google.golang.org/genproto/googleapis/iam/v1/logging,@go_googleapis//google/iam/v1/logging:logging_go_proto
312 google/iam/v1/policy.proto,@go_googleapis//google/iam/v1:iam_proto,google.golang.org/genproto/googleapis/iam/v1,@go_googleapis//google/iam/v1:iam_go_proto
313 google/logging/type/http_request.proto,@go_googleapis//google/logging/type:ltype_proto,google.golang.org/genproto/googleapis/logging/type,@go_googleapis//google/logging/type:ltype_go_proto
314 google/logging/type/log_severity.proto,@go_googleapis//google/logging/type:ltype_proto,google.golang.org/genproto/googleapis/logging/type,@go_googleapis//google/logging/type:ltype_go_proto
315 google/logging/v2/log_entry.proto,@go_googleapis//google/logging/v2:logging_proto,google.golang.org/genproto/googleapis/logging/v2,@go_googleapis//google/logging/v2:logging_go_proto
316 google/logging/v2/logging.proto,@go_googleapis//google/logging/v2:logging_proto,google.golang.org/genproto/googleapis/logging/v2,@go_googleapis//google/logging/v2:logging_go_proto
317 google/logging/v2/logging_config.proto,@go_googleapis//google/logging/v2:logging_proto,google.golang.org/genproto/googleapis/logging/v2,@go_googleapis//google/logging/v2:logging_go_proto
318 google/logging/v2/logging_metrics.proto,@go_googleapis//google/logging/v2:logging_proto,google.golang.org/genproto/googleapis/logging/v2,@go_googleapis//google/logging/v2:logging_go_proto
319 google/longrunning/operations.proto,@go_googleapis//google/longrunning:longrunning_proto,google.golang.org/genproto/googleapis/longrunning,@go_googleapis//google/longrunning:longrunning_go_proto
320 google/monitoring/v3/alert.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
321 google/monitoring/v3/alert_service.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
322 google/monitoring/v3/common.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
323 google/monitoring/v3/dropped_labels.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
324 google/monitoring/v3/group.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
325 google/monitoring/v3/group_service.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
326 google/monitoring/v3/metric.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
327 google/monitoring/v3/metric_service.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
328 google/monitoring/v3/mutation_record.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
329 google/monitoring/v3/notification.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
330 google/monitoring/v3/notification_service.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
331 google/monitoring/v3/span_context.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
332 google/monitoring/v3/uptime.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
333 google/monitoring/v3/uptime_service.proto,@go_googleapis//google/monitoring/v3:monitoring_proto,google.golang.org/genproto/googleapis/monitoring/v3,@go_googleapis//google/monitoring/v3:monitoring_go_proto
334 google/privacy/dlp/v2/dlp.proto,@go_googleapis//google/privacy/dlp/v2:dlp_proto,google.golang.org/genproto/googleapis/privacy/dlp/v2,@go_googleapis//google/privacy/dlp/v2:dlp_go_proto
335 google/privacy/dlp/v2/storage.proto,@go_googleapis//google/privacy/dlp/v2:dlp_proto,google.golang.org/genproto/googleapis/privacy/dlp/v2,@go_googleapis//google/privacy/dlp/v2:dlp_go_proto
336 google/pubsub/v1/pubsub.proto,@go_googleapis//google/pubsub/v1:pubsub_proto,google.golang.org/genproto/googleapis/pubsub/v1,@go_googleapis//google/pubsub/v1:pubsub_go_proto
337 google/pubsub/v1beta2/pubsub.proto,@go_googleapis//google/pubsub/v1beta2:pubsub_proto,google.golang.org/genproto/googleapis/pubsub/v1beta2,@go_googleapis//google/pubsub/v1beta2:pubsub_go_proto
338 google/rpc/code.proto,@go_googleapis//google/rpc:code_proto,google.golang.org/genproto/googleapis/rpc/code,@go_googleapis//google/rpc:code_go_proto
339 google/rpc/error_details.proto,@go_googleapis//google/rpc:errdetails_proto,google.golang.org/genproto/googleapis/rpc/errdetails,@go_googleapis//google/rpc:errdetails_go_proto
340 google/rpc/status.proto,@go_googleapis//google/rpc:status_proto,google.golang.org/genproto/googleapis/rpc/status,@go_googleapis//google/rpc:status_go_proto
341 google/spanner/admin/database/v1/spanner_database_admin.proto,@go_googleapis//google/spanner/admin/database/v1:database_proto,google.golang.org/genproto/googleapis/spanner/admin/database/v1,@go_googleapis//google/spanner/admin/database/v1:database_go_proto
342 google/spanner/admin/instance/v1/spanner_instance_admin.proto,@go_googleapis//google/spanner/admin/instance/v1:instance_proto,google.golang.org/genproto/googleapis/spanner/admin/instance/v1,@go_googleapis//google/spanner/admin/instance/v1:instance_go_proto
343 google/spanner/v1/keys.proto,@go_googleapis//google/spanner/v1:spanner_proto,google.golang.org/genproto/googleapis/spanner/v1,@go_googleapis//google/spanner/v1:spanner_go_proto
344 google/spanner/v1/mutation.proto,@go_googleapis//google/spanner/v1:spanner_proto,google.golang.org/genproto/googleapis/spanner/v1,@go_googleapis//google/spanner/v1:spanner_go_proto
345 google/spanner/v1/query_plan.proto,@go_googleapis//google/spanner/v1:spanner_proto,google.golang.org/genproto/googleapis/spanner/v1,@go_googleapis//google/spanner/v1:spanner_go_proto
346 google/spanner/v1/result_set.proto,@go_googleapis//google/spanner/v1:spanner_proto,google.golang.org/genproto/googleapis/spanner/v1,@go_googleapis//google/spanner/v1:spanner_go_proto
347 google/spanner/v1/spanner.proto,@go_googleapis//google/spanner/v1:spanner_proto,google.golang.org/genproto/googleapis/spanner/v1,@go_googleapis//google/spanner/v1:spanner_go_proto
348 google/spanner/v1/transaction.proto,@go_googleapis//google/spanner/v1:spanner_proto,google.golang.org/genproto/googleapis/spanner/v1,@go_googleapis//google/spanner/v1:spanner_go_proto
349 google/spanner/v1/type.proto,@go_googleapis//google/spanner/v1:spanner_proto,google.golang.org/genproto/googleapis/spanner/v1,@go_googleapis//google/spanner/v1:spanner_go_proto
350 google/storagetransfer/v1/transfer.proto,@go_googleapis//google/storagetransfer/v1:storagetransfer_proto,google.golang.org/genproto/googleapis/storagetransfer/v1,@go_googleapis//google/storagetransfer/v1:storagetransfer_go_proto
351 google/storagetransfer/v1/transfer_types.proto,@go_googleapis//google/storagetransfer/v1:storagetransfer_proto,google.golang.org/genproto/googleapis/storagetransfer/v1,@go_googleapis//google/storagetransfer/v1:storagetransfer_go_proto
352 google/streetview/publish/v1/resources.proto,@go_googleapis//google/streetview/publish/v1:publish_proto,google.golang.org/genproto/googleapis/streetview/publish/v1,@go_googleapis//google/streetview/publish/v1:publish_go_proto
353 google/streetview/publish/v1/rpcmessages.proto,@go_googleapis//google/streetview/publish/v1:publish_proto,google.golang.org/genproto/googleapis/streetview/publish/v1,@go_googleapis//google/streetview/publish/v1:publish_go_proto
354 google/streetview/publish/v1/streetview_publish.proto,@go_googleapis//google/streetview/publish/v1:publish_proto,google.golang.org/genproto/googleapis/streetview/publish/v1,@go_googleapis//google/streetview/publish/v1:publish_go_proto
355 google/type/color.proto,@go_googleapis//google/type:color_proto,google.golang.org/genproto/googleapis/type/color,@go_googleapis//google/type:color_go_proto
356 google/type/date.proto,@go_googleapis//google/type:date_proto,google.golang.org/genproto/googleapis/type/date,@go_googleapis//google/type:date_go_proto
357 google/type/dayofweek.proto,@go_googleapis//google/type:dayofweek_proto,google.golang.org/genproto/googleapis/type/dayofweek,@go_googleapis//google/type:dayofweek_go_proto
358 google/type/latlng.proto,@go_googleapis//google/type:latlng_proto,google.golang.org/genproto/googleapis/type/latlng,@go_googleapis//google/type:latlng_go_proto
359 google/type/money.proto,@go_googleapis//google/type:money_proto,google.golang.org/genproto/googleapis/type/money,@go_googleapis//google/type:money_go_proto
360 google/type/postal_address.proto,@go_googleapis//google/type:postaladdress_proto,google.golang.org/genproto/googleapis/type/postaladdress,@go_googleapis//google/type:postaladdress_go_proto
361 google/type/timeofday.proto,@go_googleapis//google/type:timeofday_proto,google.golang.org/genproto/googleapis/type/timeofday,@go_googleapis//google/type:timeofday_go_proto
362 google/watcher/v1/watch.proto,@go_googleapis//google/watcher/v1:watcher_proto,google.golang.org/genproto/googleapis/watcher/v1,@go_googleapis//google/watcher/v1:watcher_go_proto

View File

@@ -1,55 +0,0 @@
/* Copyright 2017 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package repos
import (
"io/ioutil"
"github.com/bazelbuild/bazel-gazelle/internal/label"
toml "github.com/pelletier/go-toml"
)
type depLockFile struct {
Projects []depProject `toml:"projects"`
}
type depProject struct {
Name string `toml:"name"`
Revision string `toml:"revision"`
Source string `toml:"source"`
}
func importRepoRulesDep(filename string) ([]Repo, error) {
data, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
var file depLockFile
if err := toml.Unmarshal(data, &file); err != nil {
return nil, err
}
var repos []Repo
for _, p := range file.Projects {
repos = append(repos, Repo{
Name: label.ImportPathToBazelRepoName(p.Name),
GoPrefix: p.Name,
Commit: p.Revision,
Remote: p.Source,
})
}
return repos, nil
}

View File

@@ -1,145 +0,0 @@
/* Copyright 2018 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package repos
import (
"bytes"
"encoding/json"
"io"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"regexp"
"runtime"
"strings"
"github.com/bazelbuild/bazel-gazelle/internal/label"
)
type module struct {
Path, Version string
Main bool
}
var regexMixedVersioning = regexp.MustCompile(`^(.*?)-([0-9]{14})-([a-fA-F0-9]{12})$`)
func toRepoRule(mod module) Repo {
var tag, commit string
if gr := regexMixedVersioning.FindStringSubmatch(mod.Version); gr != nil {
commit = gr[3]
} else {
tag = strings.TrimSuffix(mod.Version, "+incompatible")
}
return Repo{
Name: label.ImportPathToBazelRepoName(mod.Path),
GoPrefix: mod.Path,
Commit: commit,
Tag: tag,
}
}
func importRepoRulesModules(filename string) (repos []Repo, err error) {
tempDir, err := copyGoModToTemp(filename)
if err != nil {
return nil, err
}
defer os.RemoveAll(tempDir)
data, err := goListModulesFn(tempDir)
if err != nil {
return nil, err
}
dec := json.NewDecoder(bytes.NewReader(data))
for dec.More() {
var mod module
if err := dec.Decode(&mod); err != nil {
return nil, err
}
if mod.Main {
continue
}
repos = append(repos, toRepoRule(mod))
}
return repos, nil
}
// goListModulesFn may be overridden by tests.
var goListModulesFn = goListModules
// goListModules invokes "go list" in a directory containing a go.mod file.
func goListModules(dir string) ([]byte, error) {
goTool := findGoTool()
cmd := exec.Command(goTool, "list", "-m", "-json", "all")
cmd.Stderr = os.Stderr
cmd.Dir = dir
data, err := cmd.Output()
return data, err
}
// copyGoModToTemp copies to given go.mod file to a temporary directory.
// go list tends to mutate go.mod files, but gazelle shouldn't do that.
func copyGoModToTemp(filename string) (tempDir string, err error) {
goModOrig, err := os.Open(filename)
if err != nil {
return "", err
}
defer goModOrig.Close()
tempDir, err = ioutil.TempDir("", "gazelle-temp-gomod")
if err != nil {
return "", err
}
goModCopy, err := os.Create(filepath.Join(tempDir, "go.mod"))
if err != nil {
os.Remove(tempDir)
return "", err
}
defer func() {
if cerr := goModCopy.Close(); err == nil && cerr != nil {
err = cerr
}
}()
_, err = io.Copy(goModCopy, goModOrig)
if err != nil {
os.RemoveAll(tempDir)
return "", err
}
return tempDir, err
}
// findGoTool attempts to locate the go executable. If GOROOT is set, we'll
// prefer the one in there; otherwise, we'll rely on PATH. If the wrapper
// script generated by the gazelle rule is invoked by Bazel, it will set
// GOROOT to the configured SDK. We don't want to rely on the host SDK in
// that situation.
func findGoTool() string {
path := "go" // rely on PATH by default
if goroot, ok := os.LookupEnv("GOROOT"); ok {
path = filepath.Join(goroot, "bin", "go")
}
if runtime.GOOS == "windows" {
path += ".exe"
}
return path
}

View File

@@ -1,332 +0,0 @@
/* Copyright 2018 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package repos
import (
"bytes"
"fmt"
"os/exec"
"path"
"regexp"
"strings"
"sync"
"github.com/bazelbuild/bazel-gazelle/internal/label"
"github.com/bazelbuild/bazel-gazelle/internal/pathtools"
"golang.org/x/tools/go/vcs"
)
// UpdateRepo returns an object describing a repository at the most recent
// commit or version tag.
//
// This function uses RemoteCache to retrieve information about the repository.
// Depending on how the RemoteCache was initialized and used earlier, some
// information may already be locally available. Frequently though, information
// will be fetched over the network, so this function may be slow.
func UpdateRepo(rc *RemoteCache, importPath string) (Repo, error) {
root, name, err := rc.Root(importPath)
if err != nil {
return Repo{}, err
}
remote, vcs, err := rc.Remote(root)
if err != nil {
return Repo{}, err
}
commit, tag, err := rc.Head(remote, vcs)
if err != nil {
return Repo{}, err
}
repo := Repo{
Name: name,
GoPrefix: root,
Commit: commit,
Tag: tag,
Remote: remote,
VCS: vcs,
}
return repo, nil
}
// RemoteCache stores information about external repositories. The cache may
// be initialized with information about known repositories, i.e., those listed
// in the WORKSPACE file and mentioned on the command line. Other information
// is retrieved over the network.
//
// Public methods of RemoteCache may be slow in cases where a network fetch
// is needed. Public methods may be called concurrently.
type RemoteCache struct {
// RepoRootForImportPath is vcs.RepoRootForImportPath by default. It may
// be overridden so that tests may avoid accessing the network.
RepoRootForImportPath func(string, bool) (*vcs.RepoRoot, error)
// HeadCmd returns the latest commit on the default branch in the given
// repository. This is used by Head. It may be stubbed out for tests.
HeadCmd func(remote, vcs string) (string, error)
root, remote, head remoteCacheMap
}
// remoteCacheMap is a thread-safe, idempotent cache. It is used to store
// information which should be fetched over the network no more than once.
// This follows the Memo pattern described in The Go Programming Language,
// section 9.7.
type remoteCacheMap struct {
mu sync.Mutex
cache map[string]*remoteCacheEntry
}
type remoteCacheEntry struct {
value interface{}
err error
// ready is nil for entries that were added when the cache was initialized.
// It is non-nil for other entries. It is closed when an entry is ready,
// i.e., the operation loading the entry completed.
ready chan struct{}
}
type rootValue struct {
root, name string
}
type remoteValue struct {
remote, vcs string
}
type headValue struct {
commit, tag string
}
// NewRemoteCache creates a new RemoteCache with a set of known repositories.
// The Root and Remote methods will return information about repositories listed
// here without accessing the network. However, the Head method will still
// access the network for these repositories to retrieve information about new
// versions.
func NewRemoteCache(knownRepos []Repo) *RemoteCache {
r := &RemoteCache{
RepoRootForImportPath: vcs.RepoRootForImportPath,
HeadCmd: defaultHeadCmd,
root: remoteCacheMap{cache: make(map[string]*remoteCacheEntry)},
remote: remoteCacheMap{cache: make(map[string]*remoteCacheEntry)},
head: remoteCacheMap{cache: make(map[string]*remoteCacheEntry)},
}
for _, repo := range knownRepos {
r.root.cache[repo.GoPrefix] = &remoteCacheEntry{
value: rootValue{
root: repo.GoPrefix,
name: repo.Name,
},
}
if repo.Remote != "" {
r.remote.cache[repo.GoPrefix] = &remoteCacheEntry{
value: remoteValue{
remote: repo.Remote,
vcs: repo.VCS,
},
}
}
}
return r
}
var gopkginPattern = regexp.MustCompile("^(gopkg.in/(?:[^/]+/)?[^/]+\\.v\\d+)(?:/|$)")
var knownPrefixes = []struct {
prefix string
missing int
}{
{prefix: "golang.org/x", missing: 1},
{prefix: "google.golang.org", missing: 1},
{prefix: "cloud.google.com", missing: 1},
{prefix: "github.com", missing: 2},
}
// Root returns the portion of an import path that corresponds to the root
// directory of the repository containing the given import path. For example,
// given "golang.org/x/tools/go/loader", this will return "golang.org/x/tools".
// The workspace name of the repository is also returned. This may be a custom
// name set in WORKSPACE, or it may be a generated name based on the root path.
func (r *RemoteCache) Root(importPath string) (root, name string, err error) {
// Try prefixes of the import path in the cache, but don't actually go out
// to vcs yet. We do this before handling known special cases because
// the cache is pre-populated with repository rules, and we want to use their
// names if we can.
prefix := importPath
for {
v, ok, err := r.root.get(prefix)
if ok {
if err != nil {
return "", "", err
}
value := v.(rootValue)
return value.root, value.name, nil
}
prefix = path.Dir(prefix)
if prefix == "." || prefix == "/" {
break
}
}
// Try known prefixes.
for _, p := range knownPrefixes {
if pathtools.HasPrefix(importPath, p.prefix) {
rest := pathtools.TrimPrefix(importPath, p.prefix)
var components []string
if rest != "" {
components = strings.Split(rest, "/")
}
if len(components) < p.missing {
return "", "", fmt.Errorf("import path %q is shorter than the known prefix %q", importPath, p.prefix)
}
root = p.prefix
for _, c := range components[:p.missing] {
root = path.Join(root, c)
}
name = label.ImportPathToBazelRepoName(root)
return root, name, nil
}
}
// gopkg.in is special, and might have either one or two levels of
// missing paths. See http://labix.org/gopkg.in for URL patterns.
if match := gopkginPattern.FindStringSubmatch(importPath); len(match) > 0 {
root = match[1]
name = label.ImportPathToBazelRepoName(root)
return root, name, nil
}
// Find the prefix using vcs and cache the result.
v, err := r.root.ensure(importPath, func() (interface{}, error) {
res, err := r.RepoRootForImportPath(importPath, false)
if err != nil {
return nil, err
}
return rootValue{res.Root, label.ImportPathToBazelRepoName(res.Root)}, nil
})
if err != nil {
return "", "", err
}
value := v.(rootValue)
return value.root, value.name, nil
}
// Remote returns the VCS name and the remote URL for a repository with the
// given root import path. This is suitable for creating new repository rules.
func (r *RemoteCache) Remote(root string) (remote, vcs string, err error) {
v, err := r.remote.ensure(root, func() (interface{}, error) {
repo, err := r.RepoRootForImportPath(root, false)
if err != nil {
return nil, err
}
return remoteValue{remote: repo.Repo, vcs: repo.VCS.Cmd}, nil
})
if err != nil {
return "", "", err
}
value := v.(remoteValue)
return value.remote, value.vcs, nil
}
// Head returns the most recent commit id on the default branch and latest
// version tag for the given remote repository. The tag "" is returned if
// no latest version was found.
//
// TODO(jayconrod): support VCS other than git.
// TODO(jayconrod): support version tags. "" is always returned.
func (r *RemoteCache) Head(remote, vcs string) (commit, tag string, err error) {
if vcs != "git" {
return "", "", fmt.Errorf("could not locate recent commit in repo %q with unknown version control scheme %q", remote, vcs)
}
v, err := r.head.ensure(remote, func() (interface{}, error) {
commit, err := r.HeadCmd(remote, vcs)
if err != nil {
return nil, err
}
return headValue{commit: commit}, nil
})
if err != nil {
return "", "", err
}
value := v.(headValue)
return value.commit, value.tag, nil
}
func defaultHeadCmd(remote, vcs string) (string, error) {
switch vcs {
case "local":
return "", nil
case "git":
// Old versions of git ls-remote exit with code 129 when "--" is passed.
// We'll try to validate the argument here instead.
if strings.HasPrefix(remote, "-") {
return "", fmt.Errorf("remote must not start with '-': %q", remote)
}
cmd := exec.Command("git", "ls-remote", remote, "HEAD")
out, err := cmd.Output()
if err != nil {
return "", err
}
ix := bytes.IndexByte(out, '\t')
if ix < 0 {
return "", fmt.Errorf("could not parse output for git ls-remote for %q", remote)
}
return string(out[:ix]), nil
default:
return "", fmt.Errorf("unknown version control system: %s", vcs)
}
}
// get retrieves a value associated with the given key from the cache. ok will
// be true if the key exists in the cache, even if it's in the process of
// being fetched.
func (m *remoteCacheMap) get(key string) (value interface{}, ok bool, err error) {
m.mu.Lock()
e, ok := m.cache[key]
m.mu.Unlock()
if !ok {
return nil, ok, nil
}
if e.ready != nil {
<-e.ready
}
return e.value, ok, e.err
}
// ensure retreives a value associated with the given key from the cache. If
// the key does not exist in the cache, the load function will be called,
// and its result will be associated with the key. The load function will not
// be called more than once for any key.
func (m *remoteCacheMap) ensure(key string, load func() (interface{}, error)) (interface{}, error) {
m.mu.Lock()
e, ok := m.cache[key]
if !ok {
e = &remoteCacheEntry{ready: make(chan struct{})}
m.cache[key] = e
m.mu.Unlock()
e.value, e.err = load()
close(e.ready)
} else {
m.mu.Unlock()
if e.ready != nil {
<-e.ready
}
}
return e.value, e.err
}

View File

@@ -1,199 +0,0 @@
/* Copyright 2017 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package repos
import (
"fmt"
"os"
"path/filepath"
"sort"
"strings"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
)
// Repo describes an external repository rule declared in a Bazel
// WORKSPACE file.
type Repo struct {
// Name is the value of the "name" attribute of the repository rule.
Name string
// GoPrefix is the portion of the Go import path for the root of this
// repository. Usually the same as Remote.
GoPrefix string
// Commit is the revision at which a repository is checked out (for example,
// a Git commit id).
Commit string
// Tag is the name of the version at which a repository is checked out.
Tag string
// Remote is the URL the repository can be cloned or checked out from.
Remote string
// VCS is the version control system used to check out the repository.
// May also be "http" for HTTP archives.
VCS string
}
type byName []Repo
func (s byName) Len() int { return len(s) }
func (s byName) Less(i, j int) bool { return s[i].Name < s[j].Name }
func (s byName) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
type lockFileFormat int
const (
unknownFormat lockFileFormat = iota
depFormat
moduleFormat
)
var lockFileParsers = map[lockFileFormat]func(string) ([]Repo, error){
depFormat: importRepoRulesDep,
moduleFormat: importRepoRulesModules,
}
// ImportRepoRules reads the lock file of a vendoring tool and returns
// a list of equivalent repository rules that can be merged into a WORKSPACE
// file. The format of the file is inferred from its basename. Currently,
// only Gopkg.lock is supported.
func ImportRepoRules(filename string) ([]*rule.Rule, error) {
format := getLockFileFormat(filename)
if format == unknownFormat {
return nil, fmt.Errorf(`%s: unrecognized lock file format. Expected "Gopkg.lock"`, filename)
}
parser := lockFileParsers[format]
repos, err := parser(filename)
if err != nil {
return nil, fmt.Errorf("error parsing %q: %v", filename, err)
}
sort.Stable(byName(repos))
rules := make([]*rule.Rule, 0, len(repos))
for _, repo := range repos {
rules = append(rules, GenerateRule(repo))
}
return rules, nil
}
func getLockFileFormat(filename string) lockFileFormat {
switch filepath.Base(filename) {
case "Gopkg.lock":
return depFormat
case "go.mod":
return moduleFormat
default:
return unknownFormat
}
}
// GenerateRule returns a repository rule for the given repository that can
// be written in a WORKSPACE file.
func GenerateRule(repo Repo) *rule.Rule {
r := rule.NewRule("go_repository", repo.Name)
if repo.Commit != "" {
r.SetAttr("commit", repo.Commit)
}
if repo.Tag != "" {
r.SetAttr("tag", repo.Tag)
}
r.SetAttr("importpath", repo.GoPrefix)
if repo.Remote != "" {
r.SetAttr("remote", repo.Remote)
}
if repo.VCS != "" {
r.SetAttr("vcs", repo.VCS)
}
return r
}
// FindExternalRepo attempts to locate the directory where Bazel has fetched
// the external repository with the given name. An error is returned if the
// repository directory cannot be located.
func FindExternalRepo(repoRoot, name string) (string, error) {
// See https://docs.bazel.build/versions/master/output_directories.html
// for documentation on Bazel directory layout.
// We expect the bazel-out symlink in the workspace root directory to point to
// <output-base>/execroot/<workspace-name>/bazel-out
// We expect the external repository to be checked out at
// <output-base>/external/<name>
// Note that users can change the prefix for most of the Bazel symlinks with
// --symlink_prefix, but this does not include bazel-out.
externalPath := strings.Join([]string{repoRoot, "bazel-out", "..", "..", "..", "external", name}, string(os.PathSeparator))
cleanPath, err := filepath.EvalSymlinks(externalPath)
if err != nil {
return "", err
}
st, err := os.Stat(cleanPath)
if err != nil {
return "", err
}
if !st.IsDir() {
return "", fmt.Errorf("%s: not a directory", externalPath)
}
return cleanPath, nil
}
// ListRepositories extracts metadata about repositories declared in a
// WORKSPACE file.
//
// The set of repositories returned is necessarily incomplete, since we don't
// evaluate the file, and repositories may be declared in macros in other files.
func ListRepositories(workspace *rule.File) []Repo {
var repos []Repo
for _, r := range workspace.Rules {
name := r.Name()
if name == "" {
continue
}
var repo Repo
switch r.Kind() {
case "go_repository":
// TODO(jayconrod): extract other fields needed by go_repository.
// Currently, we don't use the result of this function to produce new
// go_repository rules, so it doesn't matter.
goPrefix := r.AttrString("importpath")
revision := r.AttrString("commit")
remote := r.AttrString("remote")
vcs := r.AttrString("vcs")
if goPrefix == "" {
continue
}
repo = Repo{
Name: name,
GoPrefix: goPrefix,
Commit: revision,
Remote: remote,
VCS: vcs,
}
// TODO(jayconrod): infer from {new_,}git_repository, {new_,}http_archive,
// local_repository.
default:
continue
}
repos = append(repos, repo)
}
// TODO(jayconrod): look for directives that describe repositories that
// aren't declared in the top-level of WORKSPACE (e.g., behind a macro).
return repos
}

View File

@@ -1,32 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"config.go",
"index.go",
],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/internal/resolve",
importpath = "github.com/bazelbuild/bazel-gazelle/internal/resolve",
visibility = ["//vendor/github.com/bazelbuild/bazel-gazelle:__subpackages__"],
deps = [
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/config:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/label:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/repos:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/rule:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -3,10 +3,10 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["label.go"],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/internal/label",
importpath = "github.com/bazelbuild/bazel-gazelle/internal/label",
visibility = ["//vendor/github.com/bazelbuild/bazel-gazelle:__subpackages__"],
deps = ["//vendor/github.com/bazelbuild/bazel-gazelle/internal/pathtools:go_default_library"],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/label",
importpath = "github.com/bazelbuild/bazel-gazelle/label",
visibility = ["//visibility:public"],
deps = ["//vendor/github.com/bazelbuild/bazel-gazelle/pathtools:go_default_library"],
)
filegroup(

View File

@@ -13,6 +13,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package label provides utilities for parsing and manipulating
// Bazel labels. See
// https://docs.bazel.build/versions/master/build-ref.html#labels
// for more information.
package label
import (
@@ -22,20 +26,36 @@ import (
"regexp"
"strings"
"github.com/bazelbuild/bazel-gazelle/internal/pathtools"
"github.com/bazelbuild/bazel-gazelle/pathtools"
)
// A Label represents a label of a build target in Bazel.
// A Label represents a label of a build target in Bazel. Labels have three
// parts: a repository name, a package name, and a target name, formatted
// as @repo//pkg:target.
type Label struct {
Repo, Pkg, Name string
Relative bool
// Repo is the repository name. If omitted, the label refers to a target
// in the current repository.
Repo string
// Pkg is the package name, which is usually the directory that contains
// the target. If both Repo and Pkg are omitted, the label is relative.
Pkg string
// Name is the name of the target the label refers to. If omitted, Name
// is assumed to be the same as Pkg.
Name string
// Relative indicates whether the label refers to a target in the current
// package. Relative is true if and only if Repo and Pkg are both omitted.
Relative bool
}
// New constructs a new label from components.
func New(repo, pkg, name string) Label {
return Label{Repo: repo, Pkg: pkg, Name: name}
}
// NoLabel is the nil value of Label. It is not a valid label and may be
// NoLabel is the zero value of Label. It is not a valid label and may be
// returned when an error occurs.
var NoLabel = Label{}
@@ -120,6 +140,9 @@ func (l Label) String() string {
return fmt.Sprintf("%s//%s:%s", repo, l.Pkg, l.Name)
}
// Abs computes an absolute label (one with a repository and package name)
// from this label. If this label is already absolute, it is returned
// unchanged.
func (l Label) Abs(repo, pkg string) Label {
if !l.Relative {
return l
@@ -127,6 +150,9 @@ func (l Label) Abs(repo, pkg string) Label {
return Label{Repo: repo, Pkg: pkg, Name: l.Name}
}
// Rel attempts to compute a relative label from this label. If this label
// is already relative or is in a different package, this label may be
// returned unchanged.
func (l Label) Rel(repo, pkg string) Label {
if l.Relative || l.Repo != repo {
return l
@@ -137,6 +163,8 @@ func (l Label) Rel(repo, pkg string) Label {
return Label{Pkg: l.Pkg, Name: l.Name}
}
// Equal returns whether two labels are exactly the same. It does not return
// true for different labels that refer to the same target.
func (l Label) Equal(other Label) bool {
return l.Repo == other.Repo &&
l.Pkg == other.Pkg &&

View File

@@ -0,0 +1,36 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"lang.go",
"update.go",
],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/language",
importpath = "github.com/bazelbuild/bazel-gazelle/language",
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/bazelbuild/bazel-gazelle/config:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/repo:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/resolve:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/rule:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//vendor/github.com/bazelbuild/bazel-gazelle/language/go:all-srcs",
"//vendor/github.com/bazelbuild/bazel-gazelle/language/proto:all-srcs",
],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,54 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"config.go",
"constants.go",
"dep.go",
"fileinfo.go",
"fix.go",
"generate.go",
"godep.go",
"kinds.go",
"known_go_imports.go",
"known_proto_imports.go",
"lang.go",
"modules.go",
"package.go",
"resolve.go",
"std_package_list.go",
"update.go",
],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/language/go",
importpath = "github.com/bazelbuild/bazel-gazelle/language/go",
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/bazelbuild/bazel-gazelle/config:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/flag:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/label:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/language:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/language/proto:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/pathtools:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/repo:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/resolve:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/rule:go_default_library",
"//vendor/github.com/bazelbuild/buildtools/build:go_default_library",
"//vendor/github.com/pelletier/go-toml:go_default_library",
"//vendor/golang.org/x/sync/errgroup:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -20,13 +20,15 @@ import (
"fmt"
"go/build"
"log"
"os"
"path"
"path/filepath"
"strings"
"github.com/bazelbuild/bazel-gazelle/internal/config"
gzflag "github.com/bazelbuild/bazel-gazelle/internal/flag"
"github.com/bazelbuild/bazel-gazelle/internal/language/proto"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
gzflag "github.com/bazelbuild/bazel-gazelle/flag"
"github.com/bazelbuild/bazel-gazelle/language/proto"
"github.com/bazelbuild/bazel-gazelle/rule"
bzl "github.com/bazelbuild/buildtools/build"
)
@@ -59,10 +61,55 @@ type goConfig struct {
// depMode determines how imports that are not standard, indexed, or local
// (under the current prefix) should be resolved.
depMode dependencyMode
// goProtoCompilers is the protocol buffers compiler(s) to use for go code.
goProtoCompilers []string
// goProtoCompilersSet indicates whether goProtoCompiler was set explicitly.
goProtoCompilersSet bool
// goGrpcCompilers is the gRPC compiler(s) to use for go code.
goGrpcCompilers []string
// goGrpcCompilersSet indicates whether goGrpcCompiler was set explicitly.
goGrpcCompilersSet bool
// goRepositoryMode is true if Gazelle was invoked by a go_repository rule.
// In this mode, we won't go out to the network to resolve external deps.
goRepositoryMode bool
// By default, internal packages are only visible to its siblings.
// goVisibility adds a list of packages the internal packages should be
// visible to
goVisibility []string
// moduleMode is true if the current directory is intended to be built
// as part of a module. Minimal module compatibility won't be supported
// if this is true in the root directory. External dependencies may be
// resolved differently (also depending on goRepositoryMode).
moduleMode bool
// submodules is a list of modules which have the current module's path
// as a prefix of their own path. This affects visibility attributes
// in internal packages.
submodules []moduleRepo
// buildExternalAttr, buildFileNamesAttr, buildFileGenerationAttr,
// buildTagsAttr, buildFileProtoModeAttr, and buildExtraArgsAttr are
// attributes for go_repository rules, set on the command line.
buildExternalAttr, buildFileNamesAttr, buildFileGenerationAttr, buildTagsAttr, buildFileProtoModeAttr, buildExtraArgsAttr string
}
var (
defaultGoProtoCompilers = []string{"@io_bazel_rules_go//proto:go_proto"}
defaultGoGrpcCompilers = []string{"@io_bazel_rules_go//proto:go_grpc"}
)
func newGoConfig() *goConfig {
gc := &goConfig{}
gc := &goConfig{
goProtoCompilers: defaultGoProtoCompilers,
goGrpcCompilers: defaultGoGrpcCompilers,
}
gc.preprocessTags()
return gc
}
@@ -77,6 +124,9 @@ func (gc *goConfig) clone() *goConfig {
for k, v := range gc.genericTags {
gcCopy.genericTags[k] = v
}
gcCopy.goProtoCompilers = gc.goProtoCompilers[:len(gc.goProtoCompilers):len(gc.goProtoCompilers)]
gcCopy.goGrpcCompilers = gc.goGrpcCompilers[:len(gc.goGrpcCompilers):len(gc.goGrpcCompilers)]
gcCopy.submodules = gc.submodules[:len(gc.submodules):len(gc.submodules)]
return &gcCopy
}
@@ -105,6 +155,14 @@ func (gc *goConfig) setBuildTags(tags string) error {
return nil
}
func getProtoMode(c *config.Config) proto.Mode {
if pc := proto.GetProtoConfig(c); pc != nil {
return pc.Mode
} else {
return proto.DisableGlobalMode
}
}
// dependencyMode determines how imports of packages outside of the prefix
// are resolved.
type dependencyMode int
@@ -160,15 +218,26 @@ func (f tagsFlag) String() string {
return ""
}
func (_ *goLang) KnownDirectives() []string {
type moduleRepo struct {
repoName, modulePath string
}
var validBuildExternalAttr = []string{"external", "vendored"}
var validBuildFileGenerationAttr = []string{"auto", "on", "off"}
var validBuildFileProtoModeAttr = []string{"default", "legacy", "disable", "disable_global", "package"}
func (*goLang) KnownDirectives() []string {
return []string{
"build_tags",
"go_grpc_compilers",
"go_proto_compilers",
"go_visibility",
"importmap_prefix",
"prefix",
}
}
func (_ *goLang) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config) {
func (*goLang) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config) {
gc := newGoConfig()
switch cmd {
case "fix", "update":
@@ -184,22 +253,81 @@ func (_ *goLang) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config) {
&externalFlag{&gc.depMode},
"external",
"external: resolve external packages with go_repository\n\tvendored: resolve external packages as packages in vendor/")
fs.Var(
&gzflag.MultiFlag{Values: &gc.goProtoCompilers, IsSet: &gc.goProtoCompilersSet},
"go_proto_compiler",
"go_proto_library compiler to use (may be repeated)")
fs.Var(
&gzflag.MultiFlag{Values: &gc.goGrpcCompilers, IsSet: &gc.goGrpcCompilersSet},
"go_grpc_compiler",
"go_proto_library compiler to use for gRPC (may be repeated)")
fs.BoolVar(
&gc.goRepositoryMode,
"go_repository_mode",
false,
"set when gazelle is invoked by go_repository")
fs.BoolVar(
&gc.moduleMode,
"go_repository_module_mode",
false,
"set when gazelle is invoked by go_repository in module mode")
case "update-repos":
fs.Var(&gzflag.AllowedStringFlag{Value: &gc.buildExternalAttr, Allowed: validBuildExternalAttr},
"build_external",
"Sets the build_external attribute for the generated go_repository rule(s).")
fs.StringVar(&gc.buildExtraArgsAttr,
"build_extra_args",
"",
"Sets the build_extra_args attribute for the generated go_repository rule(s).")
fs.Var(&gzflag.AllowedStringFlag{Value: &gc.buildFileGenerationAttr, Allowed: validBuildFileGenerationAttr},
"build_file_generation",
"Sets the build_file_generation attribute for the generated go_repository rule(s).")
fs.StringVar(&gc.buildFileNamesAttr,
"build_file_names",
"",
"Sets the build_file_name attribute for the generated go_repository rule(s).")
fs.Var(&gzflag.AllowedStringFlag{Value: &gc.buildFileProtoModeAttr, Allowed: validBuildFileProtoModeAttr},
"build_file_proto_mode",
"Sets the build_file_proto_mode attribute for the generated go_repository rule(s).")
fs.StringVar(&gc.buildTagsAttr,
"build_tags",
"",
"Sets the build_tags attribute for the generated go_repository rule(s).")
}
c.Exts[goName] = gc
}
func (_ *goLang) CheckFlags(fs *flag.FlagSet, c *config.Config) error {
func (*goLang) CheckFlags(fs *flag.FlagSet, c *config.Config) error {
// The base of the -go_prefix flag may be used to generate proto_library
// rule names when there are no .proto sources (empty rules to be deleted)
// or when the package name can't be determined.
// TODO(jayconrod): deprecate and remove this behavior.
gc := getGoConfig(c)
pc := proto.GetProtoConfig(c)
pc.GoPrefix = gc.prefix
if pc := proto.GetProtoConfig(c); pc != nil {
pc.GoPrefix = gc.prefix
}
// List modules that may refer to internal packages in this module.
for _, r := range c.Repos {
if r.Kind() != "go_repository" {
continue
}
modulePath := r.AttrString("importpath")
if !strings.HasPrefix(modulePath, gc.prefix+"/") {
continue
}
m := moduleRepo{
repoName: r.Name(),
modulePath: modulePath,
}
gc.submodules = append(gc.submodules, m)
}
return nil
}
func (_ *goLang) Configure(c *config.Config, rel string, f *rule.File) {
func (*goLang) Configure(c *config.Config, rel string, f *rule.File) {
var gc *goConfig
if raw, ok := c.Exts[goName]; !ok {
gc = newGoConfig()
@@ -208,6 +336,13 @@ func (_ *goLang) Configure(c *config.Config, rel string, f *rule.File) {
}
c.Exts[goName] = gc
if !gc.moduleMode {
st, err := os.Stat(filepath.Join(c.RepoRoot, filepath.FromSlash(rel), "go.mod"))
if err == nil && !st.IsDir() {
gc.moduleMode = true
}
}
if path.Base(rel) == "vendor" {
gc.importMapPrefix = inferImportPath(gc, rel)
gc.importMapPrefixRel = rel
@@ -234,9 +369,34 @@ func (_ *goLang) Configure(c *config.Config, rel string, f *rule.File) {
}
gc.preprocessTags()
gc.setBuildTags(d.Value)
case "go_grpc_compilers":
// Special syntax (empty value) to reset directive.
if d.Value == "" {
gc.goGrpcCompilersSet = false
gc.goGrpcCompilers = defaultGoGrpcCompilers
} else {
gc.goGrpcCompilersSet = true
gc.goGrpcCompilers = splitValue(d.Value)
}
case "go_proto_compilers":
// Special syntax (empty value) to reset directive.
if d.Value == "" {
gc.goProtoCompilersSet = false
gc.goProtoCompilers = defaultGoProtoCompilers
} else {
gc.goProtoCompilersSet = true
gc.goProtoCompilers = splitValue(d.Value)
}
case "go_visibility":
gc.goVisibility = append(gc.goVisibility, strings.TrimSpace(d.Value))
case "importmap_prefix":
gc.importMapPrefix = d.Value
gc.importMapPrefixRel = rel
case "prefix":
setPrefix(d.Value)
}
@@ -274,3 +434,14 @@ func checkPrefix(prefix string) error {
}
return nil
}
// splitDirective splits a comma-separated directive value into its component
// parts, trimming each of any whitespace characters.
func splitValue(value string) []string {
parts := strings.Split(value, ",")
values := make([]string, 0, len(parts))
for _, part := range parts {
values = append(values, strings.TrimSpace(part))
}
return values
}

View File

@@ -16,12 +16,29 @@ limitations under the License.
package golang
const (
// defaultLibName is the name of the default go_library rule in a Go
// package directory. This name was originally chosen so that rules_go
// could translate between Bazel labels and Go import paths using go_prefix.
// It is no longer needed since go_prefix was deleted.
defaultLibName = "go_default_library"
// defaultTestName is a name of an internal test corresponding to
// defaultLibName. It does not need to be consistent to something but it
// just needs to be unique in the Bazel package
defaultTestName = "go_default_test"
// legacyProtoFilegroupName is the anme of a filegroup created in legacy
// mode for libraries that contained .pb.go files and .proto files.
legacyProtoFilegroupName = "go_default_library_protos"
// grpcCompilerLabel is the label for the gRPC compiler plugin, used in the
// "compilers" attribute of go_proto_library rules.
grpcCompilerLabel = "@io_bazel_rules_go//proto:go_grpc"
// wellKnownTypesGoPrefix is the import path for the Go repository containing
// pre-generated code for the Well Known Types.
wellKnownTypesGoPrefix = "github.com/golang/protobuf"
// wellKnownTypesPkg is the package name for the predefined WKTs in rules_go.
wellKnownTypesPkg = "proto/wkt"
)

View File

@@ -18,7 +18,7 @@ std_package_list = go_rule(
attrs = {
"out": attr.output(mandatory = True),
"_gen_std_package_list": attr.label(
default = "//internal/language/go/gen_std_package_list",
default = "//language/go/gen_std_package_list",
cfg = "host",
executable = True,
),

View File

@@ -0,0 +1,68 @@
/* Copyright 2017 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package golang
import (
"io/ioutil"
"sort"
"github.com/bazelbuild/bazel-gazelle/label"
"github.com/bazelbuild/bazel-gazelle/language"
"github.com/bazelbuild/bazel-gazelle/rule"
toml "github.com/pelletier/go-toml"
)
type depLockFile struct {
Projects []depProject `toml:"projects"`
}
type depProject struct {
Name string `toml:"name"`
Revision string `toml:"revision"`
Source string `toml:"source"`
}
func importReposFromDep(args language.ImportReposArgs) language.ImportReposResult {
data, err := ioutil.ReadFile(args.Path)
if err != nil {
return language.ImportReposResult{Error: err}
}
var file depLockFile
if err := toml.Unmarshal(data, &file); err != nil {
return language.ImportReposResult{Error: err}
}
gen := make([]*rule.Rule, len(file.Projects))
for i, p := range file.Projects {
gen[i] = rule.NewRule("go_repository", label.ImportPathToBazelRepoName(p.Name))
gen[i].SetAttr("importpath", p.Name)
gen[i].SetAttr("commit", p.Revision)
if p.Source != "" {
// TODO(#411): Handle source directives correctly. It may be an import
// path, or a URL. In the case of an import path, we should resolve it
// to the correct remote and vcs. In the case of a URL, we should
// correctly determine what VCS to use (the URL will usually start
// with "https://", which is used by multiple VCSs).
gen[i].SetAttr("remote", p.Source)
gen[i].SetAttr("vcs", "git")
}
}
sort.SliceStable(gen, func(i, j int) bool {
return gen[i].Name() < gen[j].Name()
})
return language.ImportReposResult{Gen: gen}
}

View File

@@ -32,9 +32,9 @@ import (
"unicode"
"unicode/utf8"
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/language/proto"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/language/proto"
"github.com/bazelbuild/bazel-gazelle/rule"
)
// fileInfo holds information used to decide how to build a file. This
@@ -128,7 +128,7 @@ func (g tagGroup) check(c *config.Config, os, arch string) bool {
if os == "" {
return false
}
match = os == t
match = matchesOS(os, t)
} else if _, ok := rule.KnownArchSet[t]; ok {
if arch == "" {
return false
@@ -215,6 +215,9 @@ func fileNameInfo(path_ string) fileInfo {
default:
ext = unknownExt
}
if strings.HasPrefix(name, ".") || strings.HasPrefix(name, "_") {
ext = unknownExt
}
// Determine test, goos, and goarch. This is intended to match the logic
// in goodOSArchFile in go/build.
@@ -462,6 +465,9 @@ func expandSrcDir(str string, srcdir string) (string, bool) {
// so convert native paths with a different delimiter
// to "/" before starting (eg: on windows).
srcdir = filepath.ToSlash(srcdir)
if srcdir == "" {
srcdir = "."
}
// Spaces are tolerated in ${SRCDIR}, but not anywhere else.
chunks := strings.Split(str, "${SRCDIR}")
@@ -588,6 +594,20 @@ func isOSArchSpecific(info fileInfo, cgoTags tagLine) (osSpecific, archSpecific
return osSpecific, archSpecific
}
// matchesOS checks if a value is equal to either an OS value or to any of its
// aliases.
func matchesOS(os, value string) bool {
if os == value {
return true
}
for _, alias := range rule.OSAliases[os] {
if alias == value {
return true
}
}
return false
}
// checkConstraints determines whether build constraints are satisfied on
// a given platform.
//
@@ -602,7 +622,7 @@ func isOSArchSpecific(info fileInfo, cgoTags tagLine) (osSpecific, archSpecific
// is a list tags from +build comments found near the top of the file. cgoTags
// is an extra set of tags in a #cgo directive.
func checkConstraints(c *config.Config, os, arch, osSuffix, archSuffix string, fileTags []tagLine, cgoTags tagLine) bool {
if osSuffix != "" && osSuffix != os || archSuffix != "" && archSuffix != arch {
if osSuffix != "" && !matchesOS(os, osSuffix) || archSuffix != "" && archSuffix != arch {
return false
}
for _, l := range fileTags {

View File

@@ -18,9 +18,9 @@ package golang
import (
"log"
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/language/proto"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/language/proto"
"github.com/bazelbuild/bazel-gazelle/rule"
bzl "github.com/bazelbuild/buildtools/build"
)
@@ -59,7 +59,7 @@ func migrateGrpcCompilers(c *config.Config, f *rule.File) {
continue
}
r.SetKind("go_proto_library")
r.SetAttr("compilers", []string{config.GrpcCompilerLabel})
r.SetAttr("compilers", []string{grpcCompilerLabel})
}
}
@@ -74,7 +74,7 @@ func squashCgoLibrary(c *config.Config, f *rule.File) {
// Find the default cgo_library and go_library rules.
var cgoLibrary, goLibrary *rule.Rule
for _, r := range f.Rules {
if r.Kind() == "cgo_library" && r.Name() == config.DefaultCgoLibName && !r.ShouldKeep() {
if r.Kind() == "cgo_library" && r.Name() == "cgo_default_library" && !r.ShouldKeep() {
if cgoLibrary != nil {
log.Printf("%s: when fixing existing file, multiple cgo_library rules with default name found", f.Path)
continue
@@ -82,7 +82,7 @@ func squashCgoLibrary(c *config.Config, f *rule.File) {
cgoLibrary = r
continue
}
if r.Kind() == "go_library" && r.Name() == config.DefaultLibName {
if r.Kind() == "go_library" && r.Name() == defaultLibName {
if goLibrary != nil {
log.Printf("%s: when fixing existing file, multiple go_library rules with default name referencing cgo_library found", f.Path)
}
@@ -101,7 +101,7 @@ func squashCgoLibrary(c *config.Config, f *rule.File) {
if goLibrary == nil {
cgoLibrary.SetKind("go_library")
cgoLibrary.SetName(config.DefaultLibName)
cgoLibrary.SetName(defaultLibName)
cgoLibrary.SetAttr("cgo", true)
return
}
@@ -126,9 +126,9 @@ func squashXtest(c *config.Config, f *rule.File) {
if r.Kind() != "go_test" {
continue
}
if r.Name() == config.DefaultTestName {
if r.Name() == defaultTestName {
itest = r
} else if r.Name() == config.DefaultXTestName {
} else if r.Name() == "go_default_xtest" {
xtest = r
}
}
@@ -147,7 +147,7 @@ func squashXtest(c *config.Config, f *rule.File) {
// If there was no internal test, we can just rename the external test.
if itest == nil {
xtest.SetName(config.DefaultTestName)
xtest.SetName(defaultTestName)
return
}
@@ -187,8 +187,7 @@ func flattenSrcs(c *config.Config, f *rule.File) {
// are not migrated.
func removeLegacyProto(c *config.Config, f *rule.File) {
// Don't fix if the proto mode was set to something other than the default.
pc := proto.GetProtoConfig(c)
if pc.Mode != proto.DefaultMode {
if pcMode := getProtoMode(c); pcMode != proto.DefaultMode {
return
}

View File

@@ -25,21 +25,39 @@ import (
"strings"
"sync"
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/language/proto"
"github.com/bazelbuild/bazel-gazelle/internal/pathtools"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/language"
"github.com/bazelbuild/bazel-gazelle/language/proto"
"github.com/bazelbuild/bazel-gazelle/pathtools"
"github.com/bazelbuild/bazel-gazelle/rule"
)
func (gl *goLang) GenerateRules(c *config.Config, dir, rel string, f *rule.File, subdirs, regularFiles, genFiles []string, otherEmpty, otherGen []*rule.Rule) (empty, gen []*rule.Rule) {
func (gl *goLang) GenerateRules(args language.GenerateArgs) language.GenerateResult {
// Extract information about proto files. We need this to exclude .pb.go
// files and generate go_proto_library rules.
c := args.Config
gc := getGoConfig(c)
pc := proto.GetProtoConfig(c)
pcMode := getProtoMode(c)
// This is a collection of proto_library rule names that have a corresponding
// go_proto_library rule already generated.
goProtoRules := make(map[string]struct{})
var protoRuleNames []string
protoPackages := make(map[string]proto.Package)
protoFileInfo := make(map[string]proto.FileInfo)
for _, r := range otherGen {
for _, r := range args.OtherGen {
if r.Kind() == "go_proto_library" {
if proto := r.AttrString("proto"); proto != "" {
goProtoRules[proto] = struct{}{}
}
if protos := r.AttrStrings("protos"); protos != nil {
for _, proto := range protos {
goProtoRules[proto] = struct{}{}
}
}
}
if r.Kind() != "proto_library" {
continue
}
@@ -52,7 +70,7 @@ func (gl *goLang) GenerateRules(c *config.Config, dir, rel string, f *rule.File,
}
sort.Strings(protoRuleNames)
var emptyProtoRuleNames []string
for _, r := range otherEmpty {
for _, r := range args.OtherEmpty {
if r.Kind() == "proto_library" {
emptyProtoRuleNames = append(emptyProtoRuleNames, r.Name())
}
@@ -60,7 +78,9 @@ func (gl *goLang) GenerateRules(c *config.Config, dir, rel string, f *rule.File,
// If proto rule generation is enabled, exclude .pb.go files that correspond
// to any .proto files present.
if !pc.Mode.ShouldIncludePregeneratedFiles() {
regularFiles := append([]string{}, args.RegularFiles...)
genFiles := append([]string{}, args.GenFiles...)
if !pcMode.ShouldIncludePregeneratedFiles() {
keep := func(f string) bool {
if strings.HasSuffix(f, ".pb.go") {
_, ok := protoFileInfo[strings.TrimSuffix(f, ".pb.go")+".proto"]
@@ -86,34 +106,41 @@ func (gl *goLang) GenerateRules(c *config.Config, dir, rel string, f *rule.File,
// Look for a subdirectory named testdata. Only treat it as data if it does
// not contain a buildable package.
var hasTestdata bool
for _, sub := range subdirs {
for _, sub := range args.Subdirs {
if sub == "testdata" {
hasTestdata = !gl.goPkgRels[path.Join(rel, "testdata")]
hasTestdata = !gl.goPkgRels[path.Join(args.Rel, "testdata")]
break
}
}
// Build a set of packages from files in this directory.
goPackageMap, goFilesWithUnknownPackage := buildPackages(c, dir, rel, goFiles, hasTestdata)
goPackageMap, goFilesWithUnknownPackage := buildPackages(c, args.Dir, args.Rel, goFiles, hasTestdata)
// Select a package to generate rules for. If there is no package, create
// an empty package so we can generate empty rules.
var protoName string
pkg, err := selectPackage(c, dir, goPackageMap)
pkg, err := selectPackage(c, args.Dir, goPackageMap)
if err != nil {
if _, ok := err.(*build.NoGoError); ok {
if len(protoPackages) == 1 {
for name, ppkg := range protoPackages {
if _, ok := goProtoRules[":"+name]; ok {
// if a go_proto_library rule already exists for this
// proto package, treat it as if the proto package
// doesn't exist.
pkg = emptyPackage(c, args.Dir, args.Rel)
break
}
pkg = &goPackage{
name: goProtoPackageName(ppkg),
importPath: goProtoImportPath(gc, ppkg, rel),
importPath: goProtoImportPath(gc, ppkg, args.Rel),
proto: protoTargetFromProtoPackage(name, ppkg),
}
protoName = name
break
}
} else {
pkg = emptyPackage(c, dir, rel)
pkg = emptyPackage(c, args.Dir, args.Rel)
}
} else {
log.Print(err)
@@ -129,7 +156,7 @@ func (gl *goLang) GenerateRules(c *config.Config, dir, rel string, f *rule.File,
}
for _, name := range protoRuleNames {
ppkg := protoPackages[name]
if pkg.importPath == goProtoImportPath(gc, ppkg, rel) {
if pkg.importPath == goProtoImportPath(gc, ppkg, args.Rel) {
protoName = name
pkg.proto = protoTargetFromProtoPackage(name, ppkg)
break
@@ -139,26 +166,38 @@ func (gl *goLang) GenerateRules(c *config.Config, dir, rel string, f *rule.File,
// Generate rules for proto packages. These should come before the other
// Go rules.
g := newGenerator(c, f, rel)
g := &generator{
c: c,
rel: args.Rel,
shouldSetVisibility: args.File == nil || !args.File.HasDefaultVisibility(),
}
var res language.GenerateResult
var rules []*rule.Rule
var protoEmbed string
for _, name := range protoRuleNames {
if _, ok := goProtoRules[":"+name]; ok {
// if a go_proto_library rule exists for this proto_library rule
// already, skip creating another go_proto_library for it, assuming
// that a different gazelle extension is responsible for
// go_proto_library rule generation.
continue
}
ppkg := protoPackages[name]
var rs []*rule.Rule
if name == protoName {
protoEmbed, rs = g.generateProto(pc.Mode, pkg.proto, pkg.importPath)
protoEmbed, rs = g.generateProto(pcMode, pkg.proto, pkg.importPath)
} else {
target := protoTargetFromProtoPackage(name, ppkg)
importPath := goProtoImportPath(gc, ppkg, rel)
_, rs = g.generateProto(pc.Mode, target, importPath)
importPath := goProtoImportPath(gc, ppkg, args.Rel)
_, rs = g.generateProto(pcMode, target, importPath)
}
rules = append(rules, rs...)
}
for _, name := range emptyProtoRuleNames {
goProtoName := strings.TrimSuffix(name, "_proto") + "_go_proto"
empty = append(empty, rule.NewRule("go_proto_library", goProtoName))
res.Empty = append(res.Empty, rule.NewRule("go_proto_library", goProtoName))
}
if pkg != nil && pc.Mode == proto.PackageMode && pkg.firstGoFile() == "" {
if pkg != nil && pcMode == proto.PackageMode && pkg.firstGoFile() == "" {
// In proto package mode, don't generate a go_library embedding a
// go_proto_library unless there are actually go files.
protoEmbed = ""
@@ -178,7 +217,7 @@ func (gl *goLang) GenerateRules(c *config.Config, dir, rel string, f *rule.File,
// Process the other static files.
for _, file := range otherFiles {
info := otherFileInfo(filepath.Join(dir, file))
info := otherFileInfo(filepath.Join(args.Dir, file))
if err := pkg.addFile(c, info, cgo); err != nil {
log.Print(err)
}
@@ -191,11 +230,21 @@ func (gl *goLang) GenerateRules(c *config.Config, dir, rel string, f *rule.File,
for _, f := range regularFiles {
regularFileSet[f] = true
}
// Some of the generated files may have been consumed by other rules
consumedFileSet := make(map[string]bool)
for _, r := range args.OtherGen {
for _, f := range r.AttrStrings("srcs") {
consumedFileSet[f] = true
}
if f := r.AttrString("src"); f != "" {
consumedFileSet[f] = true
}
}
for _, f := range genFiles {
if regularFileSet[f] {
if regularFileSet[f] || consumedFileSet[f] {
continue
}
info := fileNameInfo(filepath.Join(dir, f))
info := fileNameInfo(filepath.Join(args.Dir, f))
if err := pkg.addFile(c, info, cgo); err != nil {
log.Print(err)
}
@@ -204,7 +253,7 @@ func (gl *goLang) GenerateRules(c *config.Config, dir, rel string, f *rule.File,
// Generate Go rules.
if protoName == "" {
// Empty proto rules for deletion.
_, rs := g.generateProto(pc.Mode, pkg.proto, pkg.importPath)
_, rs := g.generateProto(pcMode, pkg.proto, pkg.importPath)
rules = append(rules, rs...)
}
lib := g.generateLib(pkg, protoEmbed)
@@ -220,24 +269,25 @@ func (gl *goLang) GenerateRules(c *config.Config, dir, rel string, f *rule.File,
for _, r := range rules {
if r.IsEmpty(goKinds[r.Kind()]) {
empty = append(empty, r)
res.Empty = append(res.Empty, r)
} else {
gen = append(gen, r)
res.Gen = append(res.Gen, r)
res.Imports = append(res.Imports, r.PrivateAttr(config.GazelleImportsKey))
}
}
if f != nil || len(gen) > 0 {
gl.goPkgRels[rel] = true
if args.File != nil || len(res.Gen) > 0 {
gl.goPkgRels[args.Rel] = true
} else {
for _, sub := range subdirs {
if gl.goPkgRels[path.Join(rel, sub)] {
gl.goPkgRels[rel] = true
for _, sub := range args.Subdirs {
if gl.goPkgRels[path.Join(args.Rel, sub)] {
gl.goPkgRels[args.Rel] = true
break
}
}
}
return empty, gen
return res
}
func filterFiles(files *[]string, pred func(string) bool) {
@@ -336,40 +386,12 @@ func defaultPackageName(c *config.Config, rel string) string {
return pathtools.RelBaseName(rel, gc.prefix, "")
}
// hasDefaultVisibility returns whether oldFile contains a "package" rule with
// a "default_visibility" attribute. Rules generated by Gazelle should not
// have their own visibility attributes if this is the case.
func hasDefaultVisibility(oldFile *rule.File) bool {
for _, r := range oldFile.Rules {
if r.Kind() == "package" && r.Attr("default_visibility") != nil {
return true
}
}
return false
}
// checkInternalVisibility overrides the given visibility if the package is
// internal.
func checkInternalVisibility(rel, visibility string) string {
if i := strings.LastIndex(rel, "/internal/"); i >= 0 {
visibility = fmt.Sprintf("//%s:__subpackages__", rel[:i])
} else if strings.HasPrefix(rel, "internal/") {
visibility = "//:__subpackages__"
}
return visibility
}
type generator struct {
c *config.Config
rel string
shouldSetVisibility bool
}
func newGenerator(c *config.Config, f *rule.File, rel string) *generator {
shouldSetVisibility := f == nil || !hasDefaultVisibility(f)
return &generator{c: c, rel: rel, shouldSetVisibility: shouldSetVisibility}
}
func (g *generator) generateProto(mode proto.Mode, target protoTarget, importPath string) (string, []*rule.Rule) {
if !mode.ShouldGenerateRules() && mode != proto.LegacyMode {
// Don't create or delete proto rules in this mode. Any existing rules
@@ -377,14 +399,15 @@ func (g *generator) generateProto(mode proto.Mode, target protoTarget, importPat
return "", nil
}
filegroupName := config.DefaultProtosName
gc := getGoConfig(g.c)
filegroupName := legacyProtoFilegroupName
protoName := target.name
if protoName == "" {
importPath := inferImportPath(getGoConfig(g.c), g.rel)
importPath := inferImportPath(gc, g.rel)
protoName = proto.RuleName(importPath)
}
goProtoName := strings.TrimSuffix(protoName, "_proto") + "_go_proto"
visibility := []string{checkInternalVisibility(g.rel, "//visibility:public")}
visibility := g.commonVisibility(importPath)
if mode == proto.LegacyMode {
filegroup := rule.NewRule("filegroup", filegroupName)
@@ -409,7 +432,9 @@ func (g *generator) generateProto(mode proto.Mode, target protoTarget, importPat
goProtoLibrary.SetAttr("proto", ":"+protoName)
g.setImportAttrs(goProtoLibrary, importPath)
if target.hasServices {
goProtoLibrary.SetAttr("compilers", []string{"@io_bazel_rules_go//proto:go_grpc"})
goProtoLibrary.SetAttr("compilers", gc.goGrpcCompilers)
} else if gc.goProtoCompilersSet {
goProtoLibrary.SetAttr("compilers", gc.goProtoCompilers)
}
if g.shouldSetVisibility {
goProtoLibrary.SetAttr("visibility", visibility)
@@ -419,16 +444,16 @@ func (g *generator) generateProto(mode proto.Mode, target protoTarget, importPat
}
func (g *generator) generateLib(pkg *goPackage, embed string) *rule.Rule {
goLibrary := rule.NewRule("go_library", config.DefaultLibName)
goLibrary := rule.NewRule("go_library", defaultLibName)
if !pkg.library.sources.hasGo() && embed == "" {
return goLibrary // empty
}
var visibility string
var visibility []string
if pkg.isCommand() {
// Libraries made for a go_binary should not be exposed to the public.
visibility = "//visibility:private"
visibility = []string{"//visibility:private"}
} else {
visibility = checkInternalVisibility(pkg.rel, "//visibility:public")
visibility = g.commonVisibility(pkg.importPath)
}
g.setCommonAttrs(goLibrary, pkg.rel, visibility, pkg.library, embed)
g.setImportAttrs(goLibrary, pkg.importPath)
@@ -441,24 +466,24 @@ func (g *generator) generateBin(pkg *goPackage, library string) *rule.Rule {
if !pkg.isCommand() || pkg.binary.sources.isEmpty() && library == "" {
return goBinary // empty
}
visibility := checkInternalVisibility(pkg.rel, "//visibility:public")
visibility := g.commonVisibility(pkg.importPath)
g.setCommonAttrs(goBinary, pkg.rel, visibility, pkg.binary, library)
return goBinary
}
func (g *generator) generateTest(pkg *goPackage, library string) *rule.Rule {
goTest := rule.NewRule("go_test", config.DefaultTestName)
goTest := rule.NewRule("go_test", defaultTestName)
if !pkg.test.sources.hasGo() {
return goTest // empty
}
g.setCommonAttrs(goTest, pkg.rel, "", pkg.test, library)
g.setCommonAttrs(goTest, pkg.rel, nil, pkg.test, library)
if pkg.hasTestdata {
goTest.SetAttr("data", rule.GlobValue{Patterns: []string{"testdata/**"}})
}
return goTest
}
func (g *generator) setCommonAttrs(r *rule.Rule, pkgRel, visibility string, target goTarget, embed string) {
func (g *generator) setCommonAttrs(r *rule.Rule, pkgRel string, visibility []string, target goTarget, embed string) {
if !target.sources.isEmpty() {
r.SetAttr("srcs", target.sources.buildFlat())
}
@@ -471,8 +496,8 @@ func (g *generator) setCommonAttrs(r *rule.Rule, pkgRel, visibility string, targ
if !target.copts.isEmpty() {
r.SetAttr("copts", g.options(target.copts.build(), pkgRel))
}
if g.shouldSetVisibility && visibility != "" {
r.SetAttr("visibility", []string{visibility})
if g.shouldSetVisibility && len(visibility) > 0 {
r.SetAttr("visibility", visibility)
}
if embed != "" {
r.SetAttr("embed", []string{":" + embed})
@@ -481,17 +506,60 @@ func (g *generator) setCommonAttrs(r *rule.Rule, pkgRel, visibility string, targ
}
func (g *generator) setImportAttrs(r *rule.Rule, importPath string) {
gc := getGoConfig(g.c)
r.SetAttr("importpath", importPath)
goConf := getGoConfig(g.c)
if goConf.importMapPrefix != "" {
fromPrefixRel := pathtools.TrimPrefix(g.rel, goConf.importMapPrefixRel)
importMap := path.Join(goConf.importMapPrefix, fromPrefixRel)
// Set importpath_aliases if we need minimal module compatibility.
// If a package is part of a module with a v2+ semantic import version
// suffix, packages that are not part of modules may import it without
// the suffix.
if gc.goRepositoryMode && gc.moduleMode && pathtools.HasPrefix(importPath, gc.prefix) && gc.prefixRel == "" {
if mmcImportPath := pathWithoutSemver(importPath); mmcImportPath != "" {
r.SetAttr("importpath_aliases", []string{mmcImportPath})
}
}
if gc.importMapPrefix != "" {
fromPrefixRel := pathtools.TrimPrefix(g.rel, gc.importMapPrefixRel)
importMap := path.Join(gc.importMapPrefix, fromPrefixRel)
if importMap != importPath {
r.SetAttr("importmap", importMap)
}
}
}
func (g *generator) commonVisibility(importPath string) []string {
// If the Bazel package name (rel) contains "internal", add visibility for
// subpackages of the parent.
// If the import path contains "internal" but rel does not, this is
// probably an internal submodule. Add visibility for all subpackages.
relIndex := pathtools.Index(g.rel, "internal")
importIndex := pathtools.Index(importPath, "internal")
visibility := getGoConfig(g.c).goVisibility
if relIndex >= 0 {
parent := strings.TrimSuffix(g.rel[:relIndex], "/")
visibility = append(visibility, fmt.Sprintf("//%s:__subpackages__", parent))
} else if importIndex >= 0 {
visibility = append(visibility, "//:__subpackages__")
} else {
return []string{"//visibility:public"}
}
// Add visibility for any submodules that have the internal parent as
// a prefix of their module path.
if importIndex >= 0 {
gc := getGoConfig(g.c)
internalRoot := strings.TrimSuffix(importPath[:importIndex], "/")
for _, m := range gc.submodules {
if strings.HasPrefix(m.modulePath, internalRoot) {
visibility = append(visibility, fmt.Sprintf("@%s//:__subpackages__", m.repoName))
}
}
}
return visibility
}
var (
// shortOptPrefixes are strings that come at the beginning of an option
// argument that includes a path, e.g., -Ifoo/bar.

View File

@@ -0,0 +1,88 @@
/* Copyright 2019 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package golang
import (
"encoding/json"
"fmt"
"io/ioutil"
"github.com/bazelbuild/bazel-gazelle/label"
"github.com/bazelbuild/bazel-gazelle/language"
"github.com/bazelbuild/bazel-gazelle/rule"
"golang.org/x/sync/errgroup"
)
type goDepLockFile struct {
ImportPath string
GoVersion string
GodepVersion string
Packages []string
Deps []goDepProject
}
type goDepProject struct {
ImportPath string
Rev string
}
func importReposFromGodep(args language.ImportReposArgs) language.ImportReposResult {
data, err := ioutil.ReadFile(args.Path)
if err != nil {
return language.ImportReposResult{Error: err}
}
file := goDepLockFile{}
if err := json.Unmarshal(data, &file); err != nil {
return language.ImportReposResult{Error: err}
}
var eg errgroup.Group
roots := make([]string, len(file.Deps))
for i := range file.Deps {
i := i
eg.Go(func() error {
p := file.Deps[i]
repoRoot, _, err := args.Cache.Root(p.ImportPath)
if err != nil {
return err
}
roots[i] = repoRoot
return nil
})
}
if err := eg.Wait(); err != nil {
return language.ImportReposResult{Error: err}
}
gen := make([]*rule.Rule, 0, len(file.Deps))
repoToRev := make(map[string]string)
for i, p := range file.Deps {
repoRoot := roots[i]
if rev, ok := repoToRev[repoRoot]; !ok {
r := rule.NewRule("go_repository", label.ImportPathToBazelRepoName(repoRoot))
r.SetAttr("importpath", repoRoot)
r.SetAttr("commit", p.Rev)
repoToRev[repoRoot] = p.Rev
gen = append(gen, r)
} else {
if p.Rev != rev {
return language.ImportReposResult{Error: fmt.Errorf("repo %s imported at multiple revisions: %s, %s", repoRoot, p.Rev, rev)}
}
}
}
return language.ImportReposResult{Gen: gen}
}

View File

@@ -15,7 +15,7 @@ limitations under the License.
package golang
import "github.com/bazelbuild/bazel-gazelle/internal/rule"
import "github.com/bazelbuild/bazel-gazelle/rule"
var goKinds = map[string]rule.KindInfo{
"filegroup": {
@@ -78,22 +78,28 @@ var goKinds = map[string]rule.KindInfo{
"copts": true,
"embed": true,
"proto": true,
"compilers": true,
},
ResolveAttrs: map[string]bool{"deps": true},
},
"go_repository": {
MatchAttrs: []string{"importpath"},
NonEmptyAttrs: nil, // never empty
MatchAttrs: []string{"importpath"},
NonEmptyAttrs: map[string]bool{
"importpath": true,
},
MergeableAttrs: map[string]bool{
"commit": true,
"importpath": true,
"remote": true,
"replace": true,
"sha256": true,
"strip_prefix": true,
"sum": true,
"tag": true,
"type": true,
"urls": true,
"vcs": true,
"version": true,
},
},
"go_test": {

View File

@@ -0,0 +1,201 @@
// Generated by language/proto/gen/gen_known_imports.go
// From language/proto/proto.csv
package golang
import "github.com/bazelbuild/bazel-gazelle/label"
var knownGoProtoImports = map[string]label.Label{
"github.com/golang/protobuf/ptypes/any": label.New("io_bazel_rules_go", "proto/wkt", "any_go_proto"),
"google.golang.org/genproto/protobuf/api": label.New("io_bazel_rules_go", "proto/wkt", "api_go_proto"),
"github.com/golang/protobuf/protoc-gen-go/plugin": label.New("io_bazel_rules_go", "proto/wkt", "compiler_plugin_go_proto"),
"github.com/golang/protobuf/protoc-gen-go/descriptor": label.New("io_bazel_rules_go", "proto/wkt", "descriptor_go_proto"),
"github.com/golang/protobuf/ptypes/duration": label.New("io_bazel_rules_go", "proto/wkt", "duration_go_proto"),
"github.com/golang/protobuf/ptypes/empty": label.New("io_bazel_rules_go", "proto/wkt", "empty_go_proto"),
"google.golang.org/genproto/protobuf/field_mask": label.New("io_bazel_rules_go", "proto/wkt", "field_mask_go_proto"),
"google.golang.org/genproto/protobuf/source_context": label.New("io_bazel_rules_go", "proto/wkt", "source_context_go_proto"),
"github.com/golang/protobuf/ptypes/struct": label.New("io_bazel_rules_go", "proto/wkt", "struct_go_proto"),
"github.com/golang/protobuf/ptypes/timestamp": label.New("io_bazel_rules_go", "proto/wkt", "timestamp_go_proto"),
"google.golang.org/genproto/protobuf/ptype": label.New("io_bazel_rules_go", "proto/wkt", "type_go_proto"),
"github.com/golang/protobuf/ptypes/wrappers": label.New("io_bazel_rules_go", "proto/wkt", "wrappers_go_proto"),
"google.golang.org/genproto/googleapis/ads/googleads/v1/common": label.New("go_googleapis", "google/ads/googleads/v1/common", "common_go_proto"),
"google.golang.org/genproto/googleapis/ads/googleads/v1/enums": label.New("go_googleapis", "google/ads/googleads/v1/enums", "enums_go_proto"),
"google.golang.org/genproto/googleapis/ads/googleads/v1/errors": label.New("go_googleapis", "google/ads/googleads/v1/errors", "errors_go_proto"),
"google.golang.org/genproto/googleapis/ads/googleads/v1/resources": label.New("go_googleapis", "google/ads/googleads/v1/resources", "resources_go_proto"),
"google.golang.org/genproto/googleapis/ads/googleads/v1/services": label.New("go_googleapis", "google/ads/googleads/v1/services", "services_go_proto"),
"google.golang.org/genproto/googleapis/ads/googleads/v2/common": label.New("go_googleapis", "google/ads/googleads/v2/common", "common_go_proto"),
"google.golang.org/genproto/googleapis/ads/googleads/v2/enums": label.New("go_googleapis", "google/ads/googleads/v2/enums", "enums_go_proto"),
"google.golang.org/genproto/googleapis/ads/googleads/v2/errors": label.New("go_googleapis", "google/ads/googleads/v2/errors", "errors_go_proto"),
"google.golang.org/genproto/googleapis/ads/googleads/v2/resources": label.New("go_googleapis", "google/ads/googleads/v2/resources", "resources_go_proto"),
"google.golang.org/genproto/googleapis/ads/googleads/v2/services": label.New("go_googleapis", "google/ads/googleads/v2/services", "services_go_proto"),
"google.golang.org/genproto/googleapis/api/annotations": label.New("go_googleapis", "google/api", "annotations_go_proto"),
"google.golang.org/genproto/googleapis/api/serviceconfig": label.New("go_googleapis", "google/api", "serviceconfig_go_proto"),
"google.golang.org/genproto/googleapis/api/configchange": label.New("go_googleapis", "google/api", "configchange_go_proto"),
"google.golang.org/genproto/googleapis/api/distribution": label.New("go_googleapis", "google/api", "distribution_go_proto"),
"google.golang.org/genproto/googleapis/api/expr/v1alpha1": label.New("go_googleapis", "google/api/expr/v1alpha1", "expr_go_proto"),
"google.golang.org/genproto/googleapis/api/expr/v1beta1": label.New("go_googleapis", "google/api/expr/v1beta1", "expr_go_proto"),
"google.golang.org/genproto/googleapis/api/httpbody": label.New("go_googleapis", "google/api", "httpbody_go_proto"),
"google.golang.org/genproto/googleapis/api/label": label.New("go_googleapis", "google/api", "label_go_proto"),
"google.golang.org/genproto/googleapis/api": label.New("go_googleapis", "google/api", "api_go_proto"),
"google.golang.org/genproto/googleapis/api/metric": label.New("go_googleapis", "google/api", "metric_go_proto"),
"google.golang.org/genproto/googleapis/api/monitoredres": label.New("go_googleapis", "google/api", "monitoredres_go_proto"),
"google.golang.org/genproto/googleapis/api/servicecontrol/v1": label.New("go_googleapis", "google/api/servicecontrol/v1", "servicecontrol_go_proto"),
"google.golang.org/genproto/googleapis/api/servicemanagement/v1": label.New("go_googleapis", "google/api/servicemanagement/v1", "servicemanagement_go_proto"),
"google.golang.org/genproto/googleapis/appengine/legacy": label.New("go_googleapis", "google/appengine/legacy", "legacy_go_proto"),
"google.golang.org/genproto/googleapis/appengine/logging/v1": label.New("go_googleapis", "google/appengine/logging/v1", "logging_go_proto"),
"google.golang.org/genproto/googleapis/appengine/v1": label.New("go_googleapis", "google/appengine/v1", "appengine_go_proto"),
"google.golang.org/genproto/googleapis/assistant/embedded/v1alpha1": label.New("go_googleapis", "google/assistant/embedded/v1alpha1", "embedded_go_proto"),
"google.golang.org/genproto/googleapis/assistant/embedded/v1alpha2": label.New("go_googleapis", "google/assistant/embedded/v1alpha2", "embedded_go_proto"),
"google.golang.org/genproto/googleapis/bigtable/admin/cluster/v1": label.New("go_googleapis", "google/bigtable/admin/cluster/v1", "cluster_go_proto"),
"google.golang.org/genproto/googleapis/bigtable/admin/table/v1": label.New("go_googleapis", "google/bigtable/admin/table/v1", "table_go_proto"),
"google.golang.org/genproto/googleapis/bigtable/admin/v2": label.New("go_googleapis", "google/bigtable/admin/v2", "admin_go_proto"),
"google.golang.org/genproto/googleapis/bigtable/v1": label.New("go_googleapis", "google/bigtable/v1", "bigtable_go_proto"),
"google.golang.org/genproto/googleapis/bigtable/v2": label.New("go_googleapis", "google/bigtable/v2", "bigtable_go_proto"),
"google.golang.org/genproto/googleapis/bytestream": label.New("go_googleapis", "google/bytestream", "bytestream_go_proto"),
"google.golang.org/genproto/googleapis/cloud/asset/v1": label.New("go_googleapis", "google/cloud/asset/v1", "asset_go_proto"),
"google.golang.org/genproto/googleapis/cloud/asset/v1beta1": label.New("go_googleapis", "google/cloud/asset/v1beta1", "asset_go_proto"),
"google.golang.org/genproto/googleapis/cloud/asset/v1p2beta1": label.New("go_googleapis", "google/cloud/asset/v1p2beta1", "asset_go_proto"),
"google.golang.org/genproto/googleapis/cloud/audit": label.New("go_googleapis", "google/cloud/audit", "audit_go_proto"),
"google.golang.org/genproto/googleapis/cloud/automl/v1": label.New("go_googleapis", "google/cloud/automl/v1", "automl_go_proto"),
"google.golang.org/genproto/googleapis/cloud/automl/v1beta1": label.New("go_googleapis", "google/cloud/automl/v1beta1", "automl_go_proto"),
"google.golang.org/genproto/googleapis/cloud/bigquery/datatransfer/v1": label.New("go_googleapis", "google/cloud/bigquery/datatransfer/v1", "datatransfer_go_proto"),
"google.golang.org/genproto/googleapis/cloud/bigquery/logging/v1": label.New("go_googleapis", "google/cloud/bigquery/logging/v1", "logging_go_proto"),
"google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1": label.New("go_googleapis", "google/cloud/bigquery/storage/v1beta1", "storage_go_proto"),
"google.golang.org/genproto/googleapis/cloud/bigquery/v2": label.New("go_googleapis", "google/cloud/bigquery/v2", "bigquery_go_proto"),
"google.golang.org/genproto/googleapis/cloud/billing/v1": label.New("go_googleapis", "google/cloud/billing/v1", "billing_go_proto"),
"google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1beta1": label.New("go_googleapis", "google/cloud/binaryauthorization/v1beta1", "binaryauthorization_go_proto"),
"google.golang.org/genproto/googleapis/cloud/datacatalog/v1beta1": label.New("go_googleapis", "google/cloud/datacatalog/v1beta1", "datacatalog_go_proto"),
"google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1": label.New("go_googleapis", "google/cloud/datalabeling/v1beta1", "datalabeling_go_proto"),
"google.golang.org/genproto/googleapis/cloud/dataproc/v1": label.New("go_googleapis", "google/cloud/dataproc/v1", "dataproc_go_proto"),
"google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2": label.New("go_googleapis", "google/cloud/dataproc/v1beta2", "dataproc_go_proto"),
"google.golang.org/genproto/googleapis/cloud/dialogflow/v2": label.New("go_googleapis", "google/cloud/dialogflow/v2", "dialogflow_go_proto"),
"google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1": label.New("go_googleapis", "google/cloud/dialogflow/v2beta1", "dialogflow_go_proto"),
"google.golang.org/genproto/googleapis/cloud/document/v1beta1": label.New("go_googleapis", "google/cloud/document/v1beta1", "document_go_proto"),
"google.golang.org/genproto/googleapis/cloud/functions/v1beta2": label.New("go_googleapis", "google/cloud/functions/v1beta2", "functions_go_proto"),
"google.golang.org/genproto/googleapis/cloud/iot/v1": label.New("go_googleapis", "google/cloud/iot/v1", "iot_go_proto"),
"google.golang.org/genproto/googleapis/cloud/irm/v1alpha2": label.New("go_googleapis", "google/cloud/irm/v1alpha2", "irm_go_proto"),
"google.golang.org/genproto/googleapis/cloud/kms/v1": label.New("go_googleapis", "google/cloud/kms/v1", "kms_go_proto"),
"google.golang.org/genproto/googleapis/cloud/language/v1": label.New("go_googleapis", "google/cloud/language/v1", "language_go_proto"),
"google.golang.org/genproto/googleapis/cloud/language/v1beta1": label.New("go_googleapis", "google/cloud/language/v1beta1", "language_go_proto"),
"google.golang.org/genproto/googleapis/cloud/language/v1beta2": label.New("go_googleapis", "google/cloud/language/v1beta2", "language_go_proto"),
"google.golang.org/genproto/googleapis/cloud/location": label.New("go_googleapis", "google/cloud/location", "location_go_proto"),
"google.golang.org/genproto/googleapis/cloud/ml/v1": label.New("go_googleapis", "google/cloud/ml/v1", "ml_go_proto"),
"google.golang.org/genproto/googleapis/cloud/oslogin/common": label.New("go_googleapis", "google/cloud/oslogin/common", "common_go_proto"),
"google.golang.org/genproto/googleapis/cloud/oslogin/v1": label.New("go_googleapis", "google/cloud/oslogin/v1", "oslogin_go_proto"),
"google.golang.org/genproto/googleapis/cloud/oslogin/v1alpha": label.New("go_googleapis", "google/cloud/oslogin/v1alpha", "oslogin_go_proto"),
"google.golang.org/genproto/googleapis/cloud/oslogin/v1beta": label.New("go_googleapis", "google/cloud/oslogin/v1beta", "oslogin_go_proto"),
"google.golang.org/genproto/googleapis/cloud/phishingprotection/v1beta1": label.New("go_googleapis", "google/cloud/phishingprotection/v1beta1", "phishingprotection_go_proto"),
"google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1beta1": label.New("go_googleapis", "google/cloud/recaptchaenterprise/v1beta1", "recaptchaenterprise_go_proto"),
"google.golang.org/genproto/googleapis/cloud/recommender/v1beta1": label.New("go_googleapis", "google/cloud/recommender/v1beta1", "recommender_go_proto"),
"google.golang.org/genproto/googleapis/cloud/redis/v1": label.New("go_googleapis", "google/cloud/redis/v1", "redis_go_proto"),
"google.golang.org/genproto/googleapis/cloud/redis/v1beta1": label.New("go_googleapis", "google/cloud/redis/v1beta1", "redis_go_proto"),
"google.golang.org/genproto/googleapis/cloud/resourcemanager/v2": label.New("go_googleapis", "google/cloud/resourcemanager/v2", "resourcemanager_go_proto"),
"google.golang.org/genproto/googleapis/cloud/runtimeconfig/v1beta1": label.New("go_googleapis", "google/cloud/runtimeconfig/v1beta1", "runtimeconfig_go_proto"),
"google.golang.org/genproto/googleapis/cloud/scheduler/v1": label.New("go_googleapis", "google/cloud/scheduler/v1", "scheduler_go_proto"),
"google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1": label.New("go_googleapis", "google/cloud/scheduler/v1beta1", "scheduler_go_proto"),
"google.golang.org/genproto/googleapis/cloud/securitycenter/v1": label.New("go_googleapis", "google/cloud/securitycenter/v1", "securitycenter_go_proto"),
"google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1": label.New("go_googleapis", "google/cloud/securitycenter/v1beta1", "securitycenter_go_proto"),
"google.golang.org/genproto/googleapis/cloud/speech/v1": label.New("go_googleapis", "google/cloud/speech/v1", "speech_go_proto"),
"google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1": label.New("go_googleapis", "google/cloud/speech/v1p1beta1", "speech_go_proto"),
"google.golang.org/genproto/googleapis/cloud/support/common": label.New("go_googleapis", "google/cloud/support", "common_go_proto"),
"google.golang.org/genproto/googleapis/cloud/support/v1alpha1": label.New("go_googleapis", "google/cloud/support/v1alpha1", "support_go_proto"),
"google.golang.org/genproto/googleapis/cloud/talent/v4beta1": label.New("go_googleapis", "google/cloud/talent/v4beta1", "talent_go_proto"),
"google.golang.org/genproto/googleapis/cloud/tasks/v2": label.New("go_googleapis", "google/cloud/tasks/v2", "tasks_go_proto"),
"google.golang.org/genproto/googleapis/cloud/tasks/v2beta2": label.New("go_googleapis", "google/cloud/tasks/v2beta2", "tasks_go_proto"),
"google.golang.org/genproto/googleapis/cloud/tasks/v2beta3": label.New("go_googleapis", "google/cloud/tasks/v2beta3", "tasks_go_proto"),
"google.golang.org/genproto/googleapis/cloud/texttospeech/v1": label.New("go_googleapis", "google/cloud/texttospeech/v1", "texttospeech_go_proto"),
"google.golang.org/genproto/googleapis/cloud/texttospeech/v1beta1": label.New("go_googleapis", "google/cloud/texttospeech/v1beta1", "texttospeech_go_proto"),
"google.golang.org/genproto/googleapis/cloud/translate/v3": label.New("go_googleapis", "google/cloud/translate/v3", "translate_go_proto"),
"google.golang.org/genproto/googleapis/cloud/translate/v3beta1": label.New("go_googleapis", "google/cloud/translate/v3beta1", "translate_go_proto"),
"google.golang.org/genproto/googleapis/cloud/videointelligence/v1": label.New("go_googleapis", "google/cloud/videointelligence/v1", "videointelligence_go_proto"),
"google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta1": label.New("go_googleapis", "google/cloud/videointelligence/v1beta1", "videointelligence_go_proto"),
"google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta2": label.New("go_googleapis", "google/cloud/videointelligence/v1beta2", "videointelligence_go_proto"),
"google.golang.org/genproto/googleapis/cloud/videointelligence/v1p1beta1": label.New("go_googleapis", "google/cloud/videointelligence/v1p1beta1", "videointelligence_go_proto"),
"google.golang.org/genproto/googleapis/cloud/videointelligence/v1p2beta1": label.New("go_googleapis", "google/cloud/videointelligence/v1p2beta1", "videointelligence_go_proto"),
"google.golang.org/genproto/googleapis/cloud/videointelligence/v1p3beta1": label.New("go_googleapis", "google/cloud/videointelligence/v1p3beta1", "videointelligence_go_proto"),
"google.golang.org/genproto/googleapis/cloud/vision/v1": label.New("go_googleapis", "google/cloud/vision/v1", "vision_go_proto"),
"google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1": label.New("go_googleapis", "google/cloud/vision/v1p1beta1", "vision_go_proto"),
"google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1": label.New("go_googleapis", "google/cloud/vision/v1p2beta1", "vision_go_proto"),
"google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1": label.New("go_googleapis", "google/cloud/vision/v1p3beta1", "vision_go_proto"),
"google.golang.org/genproto/googleapis/cloud/vision/v1p4beta1": label.New("go_googleapis", "google/cloud/vision/v1p4beta1", "vision_go_proto"),
"google.golang.org/genproto/googleapis/cloud/webrisk/v1beta1": label.New("go_googleapis", "google/cloud/webrisk/v1beta1", "webrisk_go_proto"),
"google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha": label.New("go_googleapis", "google/cloud/websecurityscanner/v1alpha", "websecurityscanner_go_proto"),
"google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta": label.New("go_googleapis", "google/cloud/websecurityscanner/v1beta", "websecurityscanner_go_proto"),
"google.golang.org/genproto/googleapis/container/v1": label.New("go_googleapis", "google/container/v1", "container_go_proto"),
"google.golang.org/genproto/googleapis/container/v1alpha1": label.New("go_googleapis", "google/container/v1alpha1", "container_go_proto"),
"google.golang.org/genproto/googleapis/container/v1beta1": label.New("go_googleapis", "google/container/v1beta1", "container_go_proto"),
"google.golang.org/genproto/googleapis/datastore/admin/v1": label.New("go_googleapis", "google/datastore/admin/v1", "admin_go_proto"),
"google.golang.org/genproto/googleapis/datastore/admin/v1beta1": label.New("go_googleapis", "google/datastore/admin/v1beta1", "admin_go_proto"),
"google.golang.org/genproto/googleapis/datastore/v1": label.New("go_googleapis", "google/datastore/v1", "datastore_go_proto"),
"google.golang.org/genproto/googleapis/datastore/v1beta3": label.New("go_googleapis", "google/datastore/v1beta3", "datastore_go_proto"),
"google.golang.org/genproto/googleapis/devtools/build/v1": label.New("go_googleapis", "google/devtools/build/v1", "build_go_proto"),
"google.golang.org/genproto/googleapis/devtools/cloudbuild/v1": label.New("go_googleapis", "google/devtools/cloudbuild/v1", "cloudbuild_go_proto"),
"google.golang.org/genproto/googleapis/devtools/clouddebugger/v2": label.New("go_googleapis", "google/devtools/clouddebugger/v2", "clouddebugger_go_proto"),
"google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1": label.New("go_googleapis", "google/devtools/clouderrorreporting/v1beta1", "clouderrorreporting_go_proto"),
"google.golang.org/genproto/googleapis/devtools/cloudprofiler/v2": label.New("go_googleapis", "google/devtools/cloudprofiler/v2", "cloudprofiler_go_proto"),
"google.golang.org/genproto/googleapis/devtools/cloudtrace/v1": label.New("go_googleapis", "google/devtools/cloudtrace/v1", "cloudtrace_go_proto"),
"google.golang.org/genproto/googleapis/devtools/cloudtrace/v2": label.New("go_googleapis", "google/devtools/cloudtrace/v2", "cloudtrace_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1": label.New("go_googleapis", "google/devtools/containeranalysis/v1", "containeranalysis_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1alpha1": label.New("go_googleapis", "google/devtools/containeranalysis/v1alpha1", "containeranalysis_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/attestation": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/attestation", "attestation_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/build": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/build", "build_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/common": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/common", "common_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1", "containeranalysis_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/deployment": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/deployment", "deployment_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/discovery": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/discovery", "discovery_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/grafeas", "grafeas_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/image": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/image", "image_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/package": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/package", "package_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/provenance": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/provenance", "provenance_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/source": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/source", "source_go_proto"),
"google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/vulnerability": label.New("go_googleapis", "google/devtools/containeranalysis/v1beta1/vulnerability", "vulnerability_go_proto"),
"google.golang.org/genproto/googleapis/devtools/remoteexecution/v1test": label.New("go_googleapis", "google/devtools/remoteexecution/v1test", "remoteexecution_go_proto"),
"google.golang.org/genproto/googleapis/devtools/remoteworkers/v1test2": label.New("go_googleapis", "google/devtools/remoteworkers/v1test2", "remoteworkers_go_proto"),
"google.golang.org/genproto/googleapis/devtools/resultstore/v2": label.New("go_googleapis", "google/devtools/resultstore/v2", "resultstore_go_proto"),
"google.golang.org/genproto/googleapis/devtools/source/v1": label.New("go_googleapis", "google/devtools/source/v1", "source_go_proto"),
"google.golang.org/genproto/googleapis/devtools/sourcerepo/v1": label.New("go_googleapis", "google/devtools/sourcerepo/v1", "sourcerepo_go_proto"),
"google.golang.org/genproto/googleapis/example/library/v1": label.New("go_googleapis", "google/example/library/v1", "library_go_proto"),
"google.golang.org/genproto/googleapis/firebase/fcm/connection/v1alpha1": label.New("go_googleapis", "google/firebase/fcm/connection/v1alpha1", "connection_go_proto"),
"google.golang.org/genproto/googleapis/firestore/admin/v1": label.New("go_googleapis", "google/firestore/admin/v1", "admin_go_proto"),
"google.golang.org/genproto/googleapis/firestore/admin/v1beta1": label.New("go_googleapis", "google/firestore/admin/v1beta1", "admin_go_proto"),
"google.golang.org/genproto/googleapis/firestore/admin/v1beta2": label.New("go_googleapis", "google/firestore/admin/v1beta2", "admin_go_proto"),
"google.golang.org/genproto/googleapis/firestore/v1": label.New("go_googleapis", "google/firestore/v1", "firestore_go_proto"),
"google.golang.org/genproto/googleapis/firestore/v1beta1": label.New("go_googleapis", "google/firestore/v1beta1", "firestore_go_proto"),
"google.golang.org/genproto/googleapis/genomics/v1": label.New("go_googleapis", "google/genomics/v1", "genomics_go_proto"),
"google.golang.org/genproto/googleapis/genomics/v1alpha2": label.New("go_googleapis", "google/genomics/v1alpha2", "genomics_go_proto"),
"google.golang.org/genproto/googleapis/geo/type/viewport": label.New("go_googleapis", "google/geo/type", "viewport_go_proto"),
"google.golang.org/genproto/googleapis/home/graph/v1": label.New("go_googleapis", "google/home/graph/v1", "graph_go_proto"),
"google.golang.org/genproto/googleapis/iam/admin/v1": label.New("go_googleapis", "google/iam/admin/v1", "admin_go_proto"),
"google.golang.org/genproto/googleapis/iam/credentials/v1": label.New("go_googleapis", "google/iam/credentials/v1", "credentials_go_proto"),
"google.golang.org/genproto/googleapis/iam/v1": label.New("go_googleapis", "google/iam/v1", "iam_go_proto"),
"google.golang.org/genproto/googleapis/iam/v1/logging": label.New("go_googleapis", "google/iam/v1/logging", "logging_go_proto"),
"google.golang.org/genproto/googleapis/logging/type": label.New("go_googleapis", "google/logging/type", "ltype_go_proto"),
"google.golang.org/genproto/googleapis/logging/v2": label.New("go_googleapis", "google/logging/v2", "logging_go_proto"),
"google.golang.org/genproto/googleapis/longrunning": label.New("go_googleapis", "google/longrunning", "longrunning_go_proto"),
"google.golang.org/genproto/googleapis/monitoring/v3": label.New("go_googleapis", "google/monitoring/v3", "monitoring_go_proto"),
"google.golang.org/genproto/googleapis/privacy/dlp/v2": label.New("go_googleapis", "google/privacy/dlp/v2", "dlp_go_proto"),
"google.golang.org/genproto/googleapis/pubsub/v1": label.New("go_googleapis", "google/pubsub/v1", "pubsub_go_proto"),
"google.golang.org/genproto/googleapis/pubsub/v1beta2": label.New("go_googleapis", "google/pubsub/v1beta2", "pubsub_go_proto"),
"google.golang.org/genproto/googleapis/rpc/code": label.New("go_googleapis", "google/rpc", "code_go_proto"),
"google.golang.org/genproto/googleapis/rpc/errdetails": label.New("go_googleapis", "google/rpc", "errdetails_go_proto"),
"google.golang.org/genproto/googleapis/rpc/status": label.New("go_googleapis", "google/rpc", "status_go_proto"),
"google.golang.org/genproto/googleapis/spanner/admin/database/v1": label.New("go_googleapis", "google/spanner/admin/database/v1", "database_go_proto"),
"google.golang.org/genproto/googleapis/spanner/admin/instance/v1": label.New("go_googleapis", "google/spanner/admin/instance/v1", "instance_go_proto"),
"google.golang.org/genproto/googleapis/spanner/v1": label.New("go_googleapis", "google/spanner/v1", "spanner_go_proto"),
"google.golang.org/genproto/googleapis/storagetransfer/v1": label.New("go_googleapis", "google/storagetransfer/v1", "storagetransfer_go_proto"),
"google.golang.org/genproto/googleapis/streetview/publish/v1": label.New("go_googleapis", "google/streetview/publish/v1", "publish_go_proto"),
"google.golang.org/genproto/googleapis/type/calendarperiod": label.New("go_googleapis", "google/type", "calendarperiod_go_proto"),
"google.golang.org/genproto/googleapis/type/color": label.New("go_googleapis", "google/type", "color_go_proto"),
"google.golang.org/genproto/googleapis/type/date": label.New("go_googleapis", "google/type", "date_go_proto"),
"google.golang.org/genproto/googleapis/type/dayofweek": label.New("go_googleapis", "google/type", "dayofweek_go_proto"),
"google.golang.org/genproto/googleapis/type/expr": label.New("go_googleapis", "google/type", "expr_go_proto"),
"google.golang.org/genproto/googleapis/type/fraction": label.New("go_googleapis", "google/type", "fraction_go_proto"),
"google.golang.org/genproto/googleapis/type/latlng": label.New("go_googleapis", "google/type", "latlng_go_proto"),
"google.golang.org/genproto/googleapis/type/money": label.New("go_googleapis", "google/type", "money_go_proto"),
"google.golang.org/genproto/googleapis/type/postaladdress": label.New("go_googleapis", "google/type", "postaladdress_go_proto"),
"google.golang.org/genproto/googleapis/type/quaternion": label.New("go_googleapis", "google/type", "quaternion_go_proto"),
"google.golang.org/genproto/googleapis/type/timeofday": label.New("go_googleapis", "google/type", "timeofday_go_proto"),
"google.golang.org/genproto/googleapis/watcher/v1": label.New("go_googleapis", "google/watcher/v1", "watcher_go_proto"),
"google.golang.org/genproto/googleapis/grafeas/v1": label.New("go_googleapis", "grafeas/v1", "grafeas_go_proto"),
}

File diff suppressed because it is too large Load Diff

View File

@@ -51,10 +51,9 @@ limitations under the License.
//
// Gazelle has special cases for import paths associated with proto Well
// Known Types and Google APIs. rules_go declares canonical rules for these.
package golang
import "github.com/bazelbuild/bazel-gazelle/internal/language"
import "github.com/bazelbuild/bazel-gazelle/language"
const goName = "go"
@@ -66,6 +65,6 @@ type goLang struct {
func (_ *goLang) Name() string { return goName }
func New() language.Language {
func NewLanguage() language.Language {
return &goLang{goPkgRels: make(map[string]bool)}
}

View File

@@ -0,0 +1,214 @@
/* Copyright 2018 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package golang
import (
"bytes"
"encoding/json"
"go/build"
"io"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
"runtime"
"sort"
"strings"
"github.com/bazelbuild/bazel-gazelle/label"
"github.com/bazelbuild/bazel-gazelle/language"
"github.com/bazelbuild/bazel-gazelle/rule"
)
func importReposFromModules(args language.ImportReposArgs) language.ImportReposResult {
// Copy go.mod to temporary directory. We may run commands that modify it,
// and we want to leave the original alone.
tempDir, err := copyGoModToTemp(args.Path)
if err != nil {
return language.ImportReposResult{Error: err}
}
defer os.RemoveAll(tempDir)
// List all modules except for the main module, including implicit indirect
// dependencies.
type module struct {
Path, Version, Sum string
Main bool
Replace *struct {
Path, Version string
}
}
// path@version can be used as a unique identifier for looking up sums
pathToModule := map[string]*module{}
data, err := goListModules(tempDir)
if err != nil {
return language.ImportReposResult{Error: err}
}
dec := json.NewDecoder(bytes.NewReader(data))
for dec.More() {
mod := new(module)
if err := dec.Decode(mod); err != nil {
return language.ImportReposResult{Error: err}
}
if mod.Main {
continue
}
if mod.Replace != nil {
if filepath.IsAbs(mod.Replace.Path) || build.IsLocalImport(mod.Replace.Path) {
log.Printf("go_repository does not support file path replacements for %s -> %s", mod.Path,
mod.Replace.Path)
continue
}
pathToModule[mod.Replace.Path+"@"+mod.Replace.Version] = mod
} else {
pathToModule[mod.Path+"@"+mod.Version] = mod
}
}
// Load sums from go.sum. Ideally, they're all there.
goSumPath := filepath.Join(filepath.Dir(args.Path), "go.sum")
data, _ = ioutil.ReadFile(goSumPath)
lines := bytes.Split(data, []byte("\n"))
for _, line := range lines {
line = bytes.TrimSpace(line)
fields := bytes.Fields(line)
if len(fields) != 3 {
continue
}
path, version, sum := string(fields[0]), string(fields[1]), string(fields[2])
if strings.HasSuffix(version, "/go.mod") {
continue
}
if mod, ok := pathToModule[path+"@"+version]; ok {
mod.Sum = sum
}
}
// If sums are missing, run go mod download to get them.
var missingSumArgs []string
for pathVer, mod := range pathToModule {
if mod.Sum == "" {
missingSumArgs = append(missingSumArgs, pathVer)
}
}
if len(missingSumArgs) > 0 {
data, err := goModDownload(tempDir, missingSumArgs)
if err != nil {
return language.ImportReposResult{Error: err}
}
dec = json.NewDecoder(bytes.NewReader(data))
for dec.More() {
var dl module
if err := dec.Decode(&dl); err != nil {
return language.ImportReposResult{Error: err}
}
if mod, ok := pathToModule[dl.Path+"@"+dl.Version]; ok {
mod.Sum = dl.Sum
}
}
}
// Translate to repository rules.
gen := make([]*rule.Rule, 0, len(pathToModule))
for pathVer, mod := range pathToModule {
if mod.Sum == "" {
log.Printf("could not determine sum for module %s", pathVer)
continue
}
r := rule.NewRule("go_repository", label.ImportPathToBazelRepoName(mod.Path))
r.SetAttr("importpath", mod.Path)
r.SetAttr("sum", mod.Sum)
if mod.Replace == nil {
r.SetAttr("version", mod.Version)
} else {
r.SetAttr("replace", mod.Replace.Path)
r.SetAttr("version", mod.Replace.Version)
}
gen = append(gen, r)
}
sort.Slice(gen, func(i, j int) bool {
return gen[i].Name() < gen[j].Name()
})
return language.ImportReposResult{Gen: gen}
}
// goListModules invokes "go list" in a directory containing a go.mod file.
var goListModules = func(dir string) ([]byte, error) {
goTool := findGoTool()
cmd := exec.Command(goTool, "list", "-m", "-json", "all")
cmd.Stderr = os.Stderr
cmd.Dir = dir
return cmd.Output()
}
// goModDownload invokes "go mod download" in a directory containing a
// go.mod file.
var goModDownload = func(dir string, args []string) ([]byte, error) {
goTool := findGoTool()
cmd := exec.Command(goTool, "mod", "download", "-json")
cmd.Args = append(cmd.Args, args...)
cmd.Stderr = os.Stderr
cmd.Dir = dir
return cmd.Output()
}
// copyGoModToTemp copies to given go.mod file to a temporary directory.
// go list tends to mutate go.mod files, but gazelle shouldn't do that.
func copyGoModToTemp(filename string) (tempDir string, err error) {
goModOrig, err := os.Open(filename)
if err != nil {
return "", err
}
defer goModOrig.Close()
tempDir, err = ioutil.TempDir("", "gazelle-temp-gomod")
if err != nil {
return "", err
}
goModCopy, err := os.Create(filepath.Join(tempDir, "go.mod"))
if err != nil {
os.Remove(tempDir)
return "", err
}
defer func() {
if cerr := goModCopy.Close(); err == nil && cerr != nil {
err = cerr
}
}()
_, err = io.Copy(goModCopy, goModOrig)
if err != nil {
os.RemoveAll(tempDir)
return "", err
}
return tempDir, err
}
// findGoTool attempts to locate the go executable. If GOROOT is set, we'll
// prefer the one in there; otherwise, we'll rely on PATH. If the wrapper
// script generated by the gazelle rule is invoked by Bazel, it will set
// GOROOT to the configured SDK. We don't want to rely on the host SDK in
// that situation.
func findGoTool() string {
path := "go" // rely on PATH by default
if goroot, ok := os.LookupEnv("GOROOT"); ok {
path = filepath.Join(goroot, "bin", "go")
}
if runtime.GOOS == "windows" {
path += ".exe"
}
return path
}

View File

@@ -19,12 +19,13 @@ import (
"fmt"
"log"
"path"
"regexp"
"sort"
"strings"
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/language/proto"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/language/proto"
"github.com/bazelbuild/bazel-gazelle/rule"
)
// goPackage contains metadata for a set of .go and .proto files that can be
@@ -92,7 +93,7 @@ func (pkg *goPackage) addFile(c *config.Config, info fileInfo, cgo bool) error {
case info.ext == unknownExt || !cgo && (info.ext == cExt || info.ext == csExt):
return nil
case info.ext == protoExt:
if proto.GetProtoConfig(c).Mode == proto.LegacyMode {
if pcMode := getProtoMode(c); pcMode == proto.LegacyMode {
// Only add files in legacy mode. This is used to generate a filegroup
// that contains all protos. In order modes, we get the .proto files
// from information emitted by the proto language extension.
@@ -486,3 +487,21 @@ func (si *platformStringInfo) convertToPlatforms() {
si.archs = nil
}
}
var semverRex = regexp.MustCompile(`^.*?(/v\d+)(?:/.*)?$`)
// pathWithoutSemver removes a semantic version suffix from path.
// For example, if path is "example.com/foo/v2/bar", pathWithoutSemver
// will return "example.com/foo/bar". If there is no semantic version suffix,
// "" will be returned.
func pathWithoutSemver(path string) string {
m := semverRex.FindStringSubmatchIndex(path)
if m == nil {
return ""
}
v := path[m[2]+2 : m[3]]
if v[0] == '0' || v == "1" {
return ""
}
return path[:m[2]] + path[m[3]:]
}

View File

@@ -21,15 +21,15 @@ import (
"go/build"
"log"
"path"
"regexp"
"strings"
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/label"
"github.com/bazelbuild/bazel-gazelle/internal/language/proto"
"github.com/bazelbuild/bazel-gazelle/internal/pathtools"
"github.com/bazelbuild/bazel-gazelle/internal/repos"
"github.com/bazelbuild/bazel-gazelle/internal/resolve"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/label"
"github.com/bazelbuild/bazel-gazelle/pathtools"
"github.com/bazelbuild/bazel-gazelle/repo"
"github.com/bazelbuild/bazel-gazelle/resolve"
"github.com/bazelbuild/bazel-gazelle/rule"
)
func (_ *goLang) Imports(_ *config.Config, r *rule.Rule, f *rule.File) []resolve.ImportSpec {
@@ -60,20 +60,19 @@ func (_ *goLang) Embeds(r *rule.Rule, from label.Label) []label.Label {
return embedLabels
}
func (gl *goLang) Resolve(c *config.Config, ix *resolve.RuleIndex, rc *repos.RemoteCache, r *rule.Rule, from label.Label) {
importsRaw := r.PrivateAttr(config.GazelleImportsKey)
func (gl *goLang) Resolve(c *config.Config, ix *resolve.RuleIndex, rc *repo.RemoteCache, r *rule.Rule, importsRaw interface{}, from label.Label) {
if importsRaw == nil {
// may not be set in tests.
return
}
imports := importsRaw.(rule.PlatformStrings)
r.DelAttr("deps")
resolve := resolveGo
resolve := ResolveGo
if r.Kind() == "go_proto_library" {
resolve = resolveProto
}
deps, errs := imports.Map(func(imp string) (string, error) {
l, err := resolve(c, ix, rc, r, imp, from)
l, err := resolve(c, ix, rc, imp, from)
if err == skipImportError {
return "", nil
} else if err != nil {
@@ -107,9 +106,15 @@ var (
notFoundError = errors.New("rule not found")
)
func resolveGo(c *config.Config, ix *resolve.RuleIndex, rc *repos.RemoteCache, r *rule.Rule, imp string, from label.Label) (label.Label, error) {
// ResolveGo resolves a Go import path to a Bazel label, possibly using the
// given rule index and remote cache. Some special cases may be applied to
// known proto import paths, depending on the current proto mode.
//
// This may be used directly by other language extensions related to Go
// (gomock). Gazelle calls Language.Resolve instead.
func ResolveGo(c *config.Config, ix *resolve.RuleIndex, rc *repo.RemoteCache, imp string, from label.Label) (label.Label, error) {
gc := getGoConfig(c)
pc := proto.GetProtoConfig(c)
pcMode := getProtoMode(c)
if build.IsLocalImport(imp) {
cleanRel := path.Clean(path.Join(from.Pkg, imp))
if build.IsLocalImport(cleanRel) {
@@ -118,7 +123,7 @@ func resolveGo(c *config.Config, ix *resolve.RuleIndex, rc *repos.RemoteCache, r
imp = path.Join(gc.prefix, cleanRel)
}
if isStandard(imp) {
if IsStandard(imp) {
return label.NoLabel, skipImportError
}
@@ -126,7 +131,7 @@ func resolveGo(c *config.Config, ix *resolve.RuleIndex, rc *repos.RemoteCache, r
return l, nil
}
if pc.Mode.ShouldUseKnownImports() {
if pcMode.ShouldUseKnownImports() {
// These are commonly used libraries that depend on Well Known Types.
// They depend on the generated versions of these protos to avoid conflicts.
// However, since protoc-gen-go depends on these libraries, we generate
@@ -134,12 +139,16 @@ func resolveGo(c *config.Config, ix *resolve.RuleIndex, rc *repos.RemoteCache, r
// "go_default_library" versions of these libraries depend on the
// pre-generated versions of the proto libraries.
switch imp {
case "github.com/golang/protobuf/proto":
return label.New("com_github_golang_protobuf", "proto", "go_default_library"), nil
case "github.com/golang/protobuf/jsonpb":
return label.New("com_github_golang_protobuf", "jsonpb", "go_default_library_gen"), nil
case "github.com/golang/protobuf/descriptor":
return label.New("com_github_golang_protobuf", "descriptor", "go_default_library_gen"), nil
case "github.com/golang/protobuf/ptypes":
return label.New("com_github_golang_protobuf", "ptypes", "go_default_library_gen"), nil
case "github.com/golang/protobuf/protoc-gen-go/generator":
return label.New("com_github_golang_protobuf", "protoc-gen-go/generator", "go_default_library_gen"), nil
case "google.golang.org/grpc":
return label.New("org_golang_google_grpc", "", "go_default_library"), nil
}
@@ -154,20 +163,36 @@ func resolveGo(c *config.Config, ix *resolve.RuleIndex, rc *repos.RemoteCache, r
return label.NoLabel, err
}
if pathtools.HasPrefix(imp, gc.prefix) {
pkg := path.Join(gc.prefixRel, pathtools.TrimPrefix(imp, gc.prefix))
return label.New("", pkg, config.DefaultLibName), nil
// Special cases for rules_go and bazel_gazelle.
// These have names that don't following conventions and they're
// typeically declared with http_archive, not go_repository, so Gazelle
// won't recognize them.
if pathtools.HasPrefix(imp, "github.com/bazelbuild/rules_go") {
pkg := pathtools.TrimPrefix(imp, "github.com/bazelbuild/rules_go")
return label.New("io_bazel_rules_go", pkg, "go_default_library"), nil
} else if pathtools.HasPrefix(imp, "github.com/bazelbuild/bazel-gazelle") {
pkg := pathtools.TrimPrefix(imp, "github.com/bazelbuild/bazel-gazelle")
return label.New("bazel_gazelle", pkg, "go_default_library"), nil
}
if !c.IndexLibraries {
// packages in current repo were not indexed, relying on prefix to decide what may have been in
// current repo
if pathtools.HasPrefix(imp, gc.prefix) {
pkg := path.Join(gc.prefixRel, pathtools.TrimPrefix(imp, gc.prefix))
return label.New("", pkg, defaultLibName), nil
}
}
if gc.depMode == externalMode {
return resolveExternal(rc, imp)
return resolveExternal(gc.moduleMode, rc, imp)
} else {
return resolveVendored(rc, imp)
}
}
// isStandard returns whether a package is in the standard library.
func isStandard(imp string) bool {
// IsStandard returns whether a package is in the standard library.
func IsStandard(imp string) bool {
return stdPackages[imp]
}
@@ -209,7 +234,8 @@ func resolveWithIndexGo(ix *resolve.RuleIndex, imp string, from label.Label) (la
// Current match is worse
} else {
// Match is ambiguous
matchError = fmt.Errorf("multiple rules (%s and %s) may be imported with %q from %s", bestMatch.Label, m.Label, imp, from)
// TODO: consider listing all the ambiguous rules here.
matchError = fmt.Errorf("rule %s imports %q which matches multiple rules: %s and %s. # gazelle:resolve may be used to disambiguate", from, imp, bestMatch.Label, m.Label)
}
}
if matchError != nil {
@@ -224,26 +250,50 @@ func resolveWithIndexGo(ix *resolve.RuleIndex, imp string, from label.Label) (la
return bestMatch.Label, nil
}
func resolveExternal(rc *repos.RemoteCache, imp string) (label.Label, error) {
prefix, repo, err := rc.Root(imp)
var modMajorRex = regexp.MustCompile(`/v\d+(?:/|$)`)
func resolveExternal(moduleMode bool, rc *repo.RemoteCache, imp string) (label.Label, error) {
// If we're in module mode, use "go list" to find the module path and
// repository name. Otherwise, use special cases (for github.com, golang.org)
// or send a GET with ?go-get=1 to find the root. If the path contains
// a major version suffix (e.g., /v2), treat it as a module anyway though.
//
// Eventually module mode will be the only mode. But for now, it's expensive
// and not the common case, especially when known repositories aren't
// listed in WORKSPACE (which is currently the case within go_repository).
if !moduleMode {
moduleMode = pathWithoutSemver(imp) != ""
}
var prefix, repo string
var err error
if moduleMode {
prefix, repo, err = rc.Mod(imp)
} else {
prefix, repo, err = rc.Root(imp)
}
if err != nil {
return label.NoLabel, err
}
var pkg string
if imp != prefix {
if pathtools.HasPrefix(imp, prefix) {
pkg = pathtools.TrimPrefix(imp, prefix)
} else if impWithoutSemver := pathWithoutSemver(imp); pathtools.HasPrefix(impWithoutSemver, prefix) {
// We may have used minimal module compatibility to resolve a path
// without a semantic import version suffix to a repository that has one.
pkg = pathtools.TrimPrefix(impWithoutSemver, prefix)
}
return label.New(repo, pkg, config.DefaultLibName), nil
return label.New(repo, pkg, defaultLibName), nil
}
func resolveVendored(rc *repos.RemoteCache, imp string) (label.Label, error) {
return label.New("", path.Join("vendor", imp), config.DefaultLibName), nil
func resolveVendored(rc *repo.RemoteCache, imp string) (label.Label, error) {
return label.New("", path.Join("vendor", imp), defaultLibName), nil
}
func resolveProto(c *config.Config, ix *resolve.RuleIndex, rc *repos.RemoteCache, r *rule.Rule, imp string, from label.Label) (label.Label, error) {
pc := proto.GetProtoConfig(c)
func resolveProto(c *config.Config, ix *resolve.RuleIndex, rc *repo.RemoteCache, imp string, from label.Label) (label.Label, error) {
pcMode := getProtoMode(c)
if wellKnownProtos[imp] {
return label.NoLabel, skipImportError
@@ -253,7 +303,7 @@ func resolveProto(c *config.Config, ix *resolve.RuleIndex, rc *repos.RemoteCache
return l, nil
}
if l, ok := knownProtoImports[imp]; ok && pc.Mode.ShouldUseKnownImports() {
if l, ok := knownProtoImports[imp]; ok && pcMode.ShouldUseKnownImports() {
if l.Equal(from) {
return label.NoLabel, skipImportError
} else {
@@ -278,7 +328,7 @@ func resolveProto(c *config.Config, ix *resolve.RuleIndex, rc *repos.RemoteCache
if from.Pkg == "vendor" || strings.HasPrefix(from.Pkg, "vendor/") {
rel = path.Join("vendor", rel)
}
return label.New("", rel, config.DefaultLibName), nil
return label.New("", rel, defaultLibName), nil
}
// wellKnownProtos is the set of proto sets for which we don't need to add
@@ -288,7 +338,7 @@ func resolveProto(c *config.Config, ix *resolve.RuleIndex, rc *repos.RemoteCache
var wellKnownProtos = map[string]bool{
"google/protobuf/any.proto": true,
"google/protobuf/api.proto": true,
"google/protobuf/compiler_plugin.proto": true,
"google/protobuf/compiler/plugin.proto": true,
"google/protobuf/descriptor.proto": true,
"google/protobuf/duration.proto": true,
"google/protobuf/empty.proto": true,

View File

@@ -0,0 +1,678 @@
/* Copyright 2017 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Generated by gen_std_package_list.go
// DO NOT EDIT
package golang
var stdPackages = map[string]bool{
"archive/tar": true,
"archive/tar/testdata": true,
"archive/zip": true,
"archive/zip/testdata": true,
"bufio": true,
"builtin": true,
"bytes": true,
"cmd": true,
"cmd/addr2line": true,
"cmd/api": true,
"cmd/api/testdata/src/issue21181/dep": true,
"cmd/api/testdata/src/issue21181/indirect": true,
"cmd/api/testdata/src/issue21181/p": true,
"cmd/api/testdata/src/issue29837/p": true,
"cmd/api/testdata/src/pkg/p1": true,
"cmd/api/testdata/src/pkg/p2": true,
"cmd/api/testdata/src/pkg/p3": true,
"cmd/asm": true,
"cmd/asm/internal/arch": true,
"cmd/asm/internal/asm": true,
"cmd/asm/internal/asm/testdata": true,
"cmd/asm/internal/asm/testdata/avx512enc": true,
"cmd/asm/internal/flags": true,
"cmd/asm/internal/lex": true,
"cmd/buildid": true,
"cmd/cgo": true,
"cmd/compile": true,
"cmd/compile/internal/amd64": true,
"cmd/compile/internal/arm": true,
"cmd/compile/internal/arm64": true,
"cmd/compile/internal/gc": true,
"cmd/compile/internal/gc/builtin": true,
"cmd/compile/internal/gc/testdata": true,
"cmd/compile/internal/gc/testdata/gen": true,
"cmd/compile/internal/gc/testdata/reproducible": true,
"cmd/compile/internal/mips": true,
"cmd/compile/internal/mips64": true,
"cmd/compile/internal/ppc64": true,
"cmd/compile/internal/s390x": true,
"cmd/compile/internal/ssa": true,
"cmd/compile/internal/ssa/gen": true,
"cmd/compile/internal/ssa/testdata": true,
"cmd/compile/internal/syntax": true,
"cmd/compile/internal/syntax/testdata": true,
"cmd/compile/internal/test": true,
"cmd/compile/internal/types": true,
"cmd/compile/internal/wasm": true,
"cmd/compile/internal/x86": true,
"cmd/cover": true,
"cmd/cover/testdata": true,
"cmd/cover/testdata/html": true,
"cmd/dist": true,
"cmd/doc": true,
"cmd/doc/testdata": true,
"cmd/doc/testdata/nested": true,
"cmd/doc/testdata/nested/nested": true,
"cmd/fix": true,
"cmd/go": true,
"cmd/go/internal/auth": true,
"cmd/go/internal/base": true,
"cmd/go/internal/bug": true,
"cmd/go/internal/cache": true,
"cmd/go/internal/cfg": true,
"cmd/go/internal/clean": true,
"cmd/go/internal/cmdflag": true,
"cmd/go/internal/dirhash": true,
"cmd/go/internal/doc": true,
"cmd/go/internal/envcmd": true,
"cmd/go/internal/fix": true,
"cmd/go/internal/fmtcmd": true,
"cmd/go/internal/generate": true,
"cmd/go/internal/get": true,
"cmd/go/internal/help": true,
"cmd/go/internal/imports": true,
"cmd/go/internal/imports/testdata/android": true,
"cmd/go/internal/imports/testdata/illumos": true,
"cmd/go/internal/imports/testdata/star": true,
"cmd/go/internal/list": true,
"cmd/go/internal/load": true,
"cmd/go/internal/lockedfile": true,
"cmd/go/internal/lockedfile/internal/filelock": true,
"cmd/go/internal/modcmd": true,
"cmd/go/internal/modconv": true,
"cmd/go/internal/modconv/testdata": true,
"cmd/go/internal/modfetch": true,
"cmd/go/internal/modfetch/codehost": true,
"cmd/go/internal/modfile": true,
"cmd/go/internal/modfile/testdata": true,
"cmd/go/internal/modget": true,
"cmd/go/internal/modinfo": true,
"cmd/go/internal/modload": true,
"cmd/go/internal/module": true,
"cmd/go/internal/mvs": true,
"cmd/go/internal/note": true,
"cmd/go/internal/par": true,
"cmd/go/internal/renameio": true,
"cmd/go/internal/robustio": true,
"cmd/go/internal/run": true,
"cmd/go/internal/search": true,
"cmd/go/internal/semver": true,
"cmd/go/internal/str": true,
"cmd/go/internal/sumweb": true,
"cmd/go/internal/test": true,
"cmd/go/internal/tlog": true,
"cmd/go/internal/tool": true,
"cmd/go/internal/txtar": true,
"cmd/go/internal/version": true,
"cmd/go/internal/vet": true,
"cmd/go/internal/web": true,
"cmd/go/internal/work": true,
"cmd/go/testdata": true,
"cmd/go/testdata/badmod": true,
"cmd/go/testdata/failssh": true,
"cmd/go/testdata/generate": true,
"cmd/go/testdata/importcom": true,
"cmd/go/testdata/importcom/src/bad": true,
"cmd/go/testdata/importcom/src/conflict": true,
"cmd/go/testdata/importcom/src/works/x": true,
"cmd/go/testdata/importcom/src/wrongplace": true,
"cmd/go/testdata/importcycle/src/selfimport": true,
"cmd/go/testdata/local": true,
"cmd/go/testdata/local/easysub": true,
"cmd/go/testdata/local/sub": true,
"cmd/go/testdata/local/sub/sub": true,
"cmd/go/testdata/mod": true,
"cmd/go/testdata/modlegacy/src/new": true,
"cmd/go/testdata/modlegacy/src/new/p1": true,
"cmd/go/testdata/modlegacy/src/new/p2": true,
"cmd/go/testdata/modlegacy/src/new/sub": true,
"cmd/go/testdata/modlegacy/src/new/sub/inner": true,
"cmd/go/testdata/modlegacy/src/new/sub/inner/x": true,
"cmd/go/testdata/modlegacy/src/new/sub/x/v1/y": true,
"cmd/go/testdata/modlegacy/src/old/p1": true,
"cmd/go/testdata/modlegacy/src/old/p2": true,
"cmd/go/testdata/norunexample": true,
"cmd/go/testdata/rundir": true,
"cmd/go/testdata/rundir/sub": true,
"cmd/go/testdata/script": true,
"cmd/go/testdata/shadow/root1/src/foo": true,
"cmd/go/testdata/shadow/root1/src/math": true,
"cmd/go/testdata/shadow/root2/src/foo": true,
"cmd/go/testdata/src": true,
"cmd/go/testdata/src/badc": true,
"cmd/go/testdata/src/badpkg": true,
"cmd/go/testdata/src/bench": true,
"cmd/go/testdata/src/benchfatal": true,
"cmd/go/testdata/src/canonical/a": true,
"cmd/go/testdata/src/canonical/a/vendor/c": true,
"cmd/go/testdata/src/canonical/b": true,
"cmd/go/testdata/src/canonical/d": true,
"cmd/go/testdata/src/cgoasm": true,
"cmd/go/testdata/src/cgocover": true,
"cmd/go/testdata/src/cgocover2": true,
"cmd/go/testdata/src/cgocover3": true,
"cmd/go/testdata/src/cgocover4": true,
"cmd/go/testdata/src/cgotest": true,
"cmd/go/testdata/src/coverasm": true,
"cmd/go/testdata/src/coverbad": true,
"cmd/go/testdata/src/coverdep": true,
"cmd/go/testdata/src/coverdep/p1": true,
"cmd/go/testdata/src/coverdep2/p1": true,
"cmd/go/testdata/src/coverdep2/p2": true,
"cmd/go/testdata/src/coverdot1": true,
"cmd/go/testdata/src/coverdot2": true,
"cmd/go/testdata/src/dupload": true,
"cmd/go/testdata/src/dupload/p": true,
"cmd/go/testdata/src/dupload/p2": true,
"cmd/go/testdata/src/dupload/vendor/p": true,
"cmd/go/testdata/src/empty/pkg": true,
"cmd/go/testdata/src/empty/pkgtest": true,
"cmd/go/testdata/src/empty/pkgtestxtest": true,
"cmd/go/testdata/src/empty/pkgxtest": true,
"cmd/go/testdata/src/empty/test": true,
"cmd/go/testdata/src/empty/testxtest": true,
"cmd/go/testdata/src/empty/xtest": true,
"cmd/go/testdata/src/exclude": true,
"cmd/go/testdata/src/exclude/empty": true,
"cmd/go/testdata/src/exclude/ignore": true,
"cmd/go/testdata/src/gencycle": true,
"cmd/go/testdata/src/go-cmd-test": true,
"cmd/go/testdata/src/hello": true,
"cmd/go/testdata/src/importmain/ismain": true,
"cmd/go/testdata/src/importmain/test": true,
"cmd/go/testdata/src/main_test": true,
"cmd/go/testdata/src/multimain": true,
"cmd/go/testdata/src/my.pkg": true,
"cmd/go/testdata/src/my.pkg/main": true,
"cmd/go/testdata/src/not_main": true,
"cmd/go/testdata/src/notest": true,
"cmd/go/testdata/src/run": true,
"cmd/go/testdata/src/run/internal": true,
"cmd/go/testdata/src/run/subdir/internal/private": true,
"cmd/go/testdata/src/skipper": true,
"cmd/go/testdata/src/sleepy1": true,
"cmd/go/testdata/src/sleepy2": true,
"cmd/go/testdata/src/sleepybad": true,
"cmd/go/testdata/src/syntaxerror": true,
"cmd/go/testdata/src/testcache": true,
"cmd/go/testdata/src/testcycle/p1": true,
"cmd/go/testdata/src/testcycle/p2": true,
"cmd/go/testdata/src/testcycle/p3": true,
"cmd/go/testdata/src/testcycle/q1": true,
"cmd/go/testdata/src/testdep/p1": true,
"cmd/go/testdata/src/testdep/p2": true,
"cmd/go/testdata/src/testdep/p3": true,
"cmd/go/testdata/src/testlist": true,
"cmd/go/testdata/src/testnorun": true,
"cmd/go/testdata/src/testrace": true,
"cmd/go/testdata/src/testregexp": true,
"cmd/go/testdata/src/vend": true,
"cmd/go/testdata/src/vend/dir1": true,
"cmd/go/testdata/src/vend/hello": true,
"cmd/go/testdata/src/vend/subdir": true,
"cmd/go/testdata/src/vend/vendor/p": true,
"cmd/go/testdata/src/vend/vendor/q": true,
"cmd/go/testdata/src/vend/vendor/strings": true,
"cmd/go/testdata/src/vend/vendor/vend/dir1/dir2": true,
"cmd/go/testdata/src/vend/x": true,
"cmd/go/testdata/src/vend/x/invalid": true,
"cmd/go/testdata/src/vend/x/vendor/p": true,
"cmd/go/testdata/src/vend/x/vendor/p/p": true,
"cmd/go/testdata/src/vend/x/vendor/r": true,
"cmd/go/testdata/src/vetcycle": true,
"cmd/go/testdata/src/vetfail/p1": true,
"cmd/go/testdata/src/vetfail/p2": true,
"cmd/go/testdata/src/vetpkg": true,
"cmd/go/testdata/src/xtestonly": true,
"cmd/go/testdata/testcover/pkg1": true,
"cmd/go/testdata/testcover/pkg2": true,
"cmd/go/testdata/testcover/pkg3": true,
"cmd/go/testdata/testcover/pkg4": true,
"cmd/go/testdata/testimport": true,
"cmd/go/testdata/testimport/p1": true,
"cmd/go/testdata/testimport/p2": true,
"cmd/go/testdata/testinternal": true,
"cmd/go/testdata/testinternal2": true,
"cmd/go/testdata/testinternal2/x/y/z/internal/w": true,
"cmd/go/testdata/testinternal3": true,
"cmd/go/testdata/testinternal4/src/p": true,
"cmd/go/testdata/testinternal4/src/q/internal/x": true,
"cmd/go/testdata/testinternal4/src/q/j": true,
"cmd/go/testdata/testonly": true,
"cmd/go/testdata/testonly2": true,
"cmd/go/testdata/testterminal18153": true,
"cmd/go/testdata/testvendor/src/p": true,
"cmd/go/testdata/testvendor/src/q/vendor/x": true,
"cmd/go/testdata/testvendor/src/q/y": true,
"cmd/go/testdata/testvendor/src/q/z": true,
"cmd/go/testdata/testvendor2/src/p": true,
"cmd/go/testdata/testvendor2/vendor/x": true,
"cmd/gofmt": true,
"cmd/gofmt/testdata": true,
"cmd/internal/bio": true,
"cmd/internal/browser": true,
"cmd/internal/buildid": true,
"cmd/internal/buildid/testdata": true,
"cmd/internal/dwarf": true,
"cmd/internal/edit": true,
"cmd/internal/gcprog": true,
"cmd/internal/goobj": true,
"cmd/internal/goobj/testdata": true,
"cmd/internal/goobj/testdata/mycgo": true,
"cmd/internal/obj": true,
"cmd/internal/obj/arm": true,
"cmd/internal/obj/arm64": true,
"cmd/internal/obj/mips": true,
"cmd/internal/obj/ppc64": true,
"cmd/internal/obj/s390x": true,
"cmd/internal/obj/wasm": true,
"cmd/internal/obj/x86": true,
"cmd/internal/objabi": true,
"cmd/internal/objfile": true,
"cmd/internal/src": true,
"cmd/internal/sys": true,
"cmd/internal/test2json": true,
"cmd/internal/test2json/testdata": true,
"cmd/link": true,
"cmd/link/internal/amd64": true,
"cmd/link/internal/arm": true,
"cmd/link/internal/arm64": true,
"cmd/link/internal/ld": true,
"cmd/link/internal/ld/testdata/httptest/main": true,
"cmd/link/internal/ld/testdata/issue10978": true,
"cmd/link/internal/ld/testdata/issue25459/a": true,
"cmd/link/internal/ld/testdata/issue25459/main": true,
"cmd/link/internal/ld/testdata/issue26237/b.dir": true,
"cmd/link/internal/ld/testdata/issue26237/main": true,
"cmd/link/internal/ld/testdata/issue32233/lib": true,
"cmd/link/internal/ld/testdata/issue32233/main": true,
"cmd/link/internal/loadelf": true,
"cmd/link/internal/loadmacho": true,
"cmd/link/internal/loadpe": true,
"cmd/link/internal/loadxcoff": true,
"cmd/link/internal/mips": true,
"cmd/link/internal/mips64": true,
"cmd/link/internal/objfile": true,
"cmd/link/internal/ppc64": true,
"cmd/link/internal/s390x": true,
"cmd/link/internal/sym": true,
"cmd/link/internal/wasm": true,
"cmd/link/internal/x86": true,
"cmd/link/testdata": true,
"cmd/nm": true,
"cmd/objdump": true,
"cmd/objdump/testdata": true,
"cmd/pack": true,
"cmd/pprof": true,
"cmd/test2json": true,
"cmd/trace": true,
"cmd/vendor": true,
"cmd/vendor/github.com/google/pprof": true,
"cmd/vendor/github.com/google/pprof/driver": true,
"cmd/vendor/github.com/google/pprof/internal/binutils": true,
"cmd/vendor/github.com/google/pprof/internal/driver": true,
"cmd/vendor/github.com/google/pprof/internal/elfexec": true,
"cmd/vendor/github.com/google/pprof/internal/graph": true,
"cmd/vendor/github.com/google/pprof/internal/measurement": true,
"cmd/vendor/github.com/google/pprof/internal/plugin": true,
"cmd/vendor/github.com/google/pprof/internal/report": true,
"cmd/vendor/github.com/google/pprof/internal/symbolizer": true,
"cmd/vendor/github.com/google/pprof/internal/symbolz": true,
"cmd/vendor/github.com/google/pprof/internal/transport": true,
"cmd/vendor/github.com/google/pprof/profile": true,
"cmd/vendor/github.com/google/pprof/third_party/d3": true,
"cmd/vendor/github.com/google/pprof/third_party/d3flamegraph": true,
"cmd/vendor/github.com/google/pprof/third_party/svgpan": true,
"cmd/vendor/github.com/ianlancetaylor/demangle": true,
"cmd/vendor/golang.org/x/arch": true,
"cmd/vendor/golang.org/x/arch/arm/armasm": true,
"cmd/vendor/golang.org/x/arch/arm64/arm64asm": true,
"cmd/vendor/golang.org/x/arch/ppc64/ppc64asm": true,
"cmd/vendor/golang.org/x/arch/x86/x86asm": true,
"cmd/vendor/golang.org/x/crypto": true,
"cmd/vendor/golang.org/x/crypto/ssh/terminal": true,
"cmd/vendor/golang.org/x/sys": true,
"cmd/vendor/golang.org/x/sys/unix": true,
"cmd/vendor/golang.org/x/sys/windows": true,
"cmd/vendor/golang.org/x/tools": true,
"cmd/vendor/golang.org/x/tools/go/analysis": true,
"cmd/vendor/golang.org/x/tools/go/analysis/internal/analysisflags": true,
"cmd/vendor/golang.org/x/tools/go/analysis/internal/facts": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/assign": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/atomic": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/bools": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/cgocall": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/composite": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/copylock": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/ctrlflow": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/errorsas": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/httpresponse": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/inspect": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/internal/analysisutil": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/loopclosure": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/lostcancel": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/nilfunc": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/printf": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/shift": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/stdmethods": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/tests": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/unmarshal": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/unreachable": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/unsafeptr": true,
"cmd/vendor/golang.org/x/tools/go/analysis/passes/unusedresult": true,
"cmd/vendor/golang.org/x/tools/go/analysis/unitchecker": true,
"cmd/vendor/golang.org/x/tools/go/ast/astutil": true,
"cmd/vendor/golang.org/x/tools/go/ast/inspector": true,
"cmd/vendor/golang.org/x/tools/go/cfg": true,
"cmd/vendor/golang.org/x/tools/go/types/objectpath": true,
"cmd/vendor/golang.org/x/tools/go/types/typeutil": true,
"cmd/vet": true,
"cmd/vet/testdata/asm": true,
"cmd/vet/testdata/assign": true,
"cmd/vet/testdata/atomic": true,
"cmd/vet/testdata/bool": true,
"cmd/vet/testdata/buildtag": true,
"cmd/vet/testdata/cgo": true,
"cmd/vet/testdata/composite": true,
"cmd/vet/testdata/copylock": true,
"cmd/vet/testdata/deadcode": true,
"cmd/vet/testdata/httpresponse": true,
"cmd/vet/testdata/lostcancel": true,
"cmd/vet/testdata/method": true,
"cmd/vet/testdata/nilfunc": true,
"cmd/vet/testdata/print": true,
"cmd/vet/testdata/rangeloop": true,
"cmd/vet/testdata/shift": true,
"cmd/vet/testdata/structtag": true,
"cmd/vet/testdata/tagtest": true,
"cmd/vet/testdata/testingpkg": true,
"cmd/vet/testdata/unmarshal": true,
"cmd/vet/testdata/unsafeptr": true,
"cmd/vet/testdata/unused": true,
"compress/bzip2": true,
"compress/bzip2/testdata": true,
"compress/flate": true,
"compress/flate/testdata": true,
"compress/gzip": true,
"compress/gzip/testdata": true,
"compress/lzw": true,
"compress/testdata": true,
"compress/zlib": true,
"container/heap": true,
"container/list": true,
"container/ring": true,
"context": true,
"crypto": true,
"crypto/aes": true,
"crypto/cipher": true,
"crypto/des": true,
"crypto/dsa": true,
"crypto/ecdsa": true,
"crypto/ecdsa/testdata": true,
"crypto/ed25519": true,
"crypto/ed25519/internal/edwards25519": true,
"crypto/ed25519/testdata": true,
"crypto/elliptic": true,
"crypto/hmac": true,
"crypto/internal/randutil": true,
"crypto/internal/subtle": true,
"crypto/md5": true,
"crypto/rand": true,
"crypto/rc4": true,
"crypto/rsa": true,
"crypto/rsa/testdata": true,
"crypto/sha1": true,
"crypto/sha256": true,
"crypto/sha512": true,
"crypto/subtle": true,
"crypto/tls": true,
"crypto/tls/testdata": true,
"crypto/x509": true,
"crypto/x509/pkix": true,
"crypto/x509/testdata": true,
"database/sql": true,
"database/sql/driver": true,
"debug/dwarf": true,
"debug/dwarf/testdata": true,
"debug/elf": true,
"debug/elf/testdata": true,
"debug/gosym": true,
"debug/gosym/testdata": true,
"debug/macho": true,
"debug/macho/testdata": true,
"debug/pe": true,
"debug/pe/testdata": true,
"debug/plan9obj": true,
"debug/plan9obj/testdata": true,
"encoding": true,
"encoding/ascii85": true,
"encoding/asn1": true,
"encoding/base32": true,
"encoding/base64": true,
"encoding/binary": true,
"encoding/csv": true,
"encoding/gob": true,
"encoding/hex": true,
"encoding/json": true,
"encoding/json/testdata": true,
"encoding/pem": true,
"encoding/xml": true,
"errors": true,
"expvar": true,
"flag": true,
"fmt": true,
"go/ast": true,
"go/build": true,
"go/build/testdata/doc": true,
"go/build/testdata/empty": true,
"go/build/testdata/multi": true,
"go/build/testdata/other": true,
"go/build/testdata/other/file": true,
"go/build/testdata/withvendor/src/a/b": true,
"go/build/testdata/withvendor/src/a/vendor/c/d": true,
"go/constant": true,
"go/doc": true,
"go/doc/testdata": true,
"go/format": true,
"go/importer": true,
"go/internal/gccgoimporter": true,
"go/internal/gccgoimporter/testdata": true,
"go/internal/gcimporter": true,
"go/internal/gcimporter/testdata": true,
"go/internal/gcimporter/testdata/versions": true,
"go/internal/srcimporter": true,
"go/internal/srcimporter/testdata/issue20855": true,
"go/internal/srcimporter/testdata/issue23092": true,
"go/internal/srcimporter/testdata/issue24392": true,
"go/parser": true,
"go/parser/testdata": true,
"go/printer": true,
"go/printer/testdata": true,
"go/scanner": true,
"go/token": true,
"go/types": true,
"go/types/testdata": true,
"hash": true,
"hash/adler32": true,
"hash/crc32": true,
"hash/crc64": true,
"hash/fnv": true,
"html": true,
"html/template": true,
"image": true,
"image/color": true,
"image/color/palette": true,
"image/draw": true,
"image/gif": true,
"image/internal/imageutil": true,
"image/jpeg": true,
"image/png": true,
"image/png/testdata": true,
"image/png/testdata/pngsuite": true,
"image/testdata": true,
"index/suffixarray": true,
"internal/bytealg": true,
"internal/cfg": true,
"internal/cpu": true,
"internal/fmtsort": true,
"internal/goroot": true,
"internal/goversion": true,
"internal/lazyregexp": true,
"internal/lazytemplate": true,
"internal/nettrace": true,
"internal/oserror": true,
"internal/poll": true,
"internal/race": true,
"internal/reflectlite": true,
"internal/singleflight": true,
"internal/syscall/unix": true,
"internal/syscall/windows": true,
"internal/syscall/windows/registry": true,
"internal/syscall/windows/sysdll": true,
"internal/testenv": true,
"internal/testlog": true,
"internal/trace": true,
"internal/trace/testdata": true,
"internal/xcoff": true,
"internal/xcoff/testdata": true,
"io": true,
"io/ioutil": true,
"io/ioutil/testdata": true,
"log": true,
"log/syslog": true,
"math": true,
"math/big": true,
"math/bits": true,
"math/cmplx": true,
"math/rand": true,
"mime": true,
"mime/multipart": true,
"mime/multipart/testdata": true,
"mime/quotedprintable": true,
"mime/testdata": true,
"net": true,
"net/http": true,
"net/http/cgi": true,
"net/http/cgi/testdata": true,
"net/http/cookiejar": true,
"net/http/fcgi": true,
"net/http/httptest": true,
"net/http/httptrace": true,
"net/http/httputil": true,
"net/http/internal": true,
"net/http/pprof": true,
"net/http/testdata": true,
"net/internal/socktest": true,
"net/mail": true,
"net/rpc": true,
"net/rpc/jsonrpc": true,
"net/smtp": true,
"net/testdata": true,
"net/textproto": true,
"net/url": true,
"os": true,
"os/exec": true,
"os/signal": true,
"os/signal/internal/pty": true,
"os/user": true,
"path": true,
"path/filepath": true,
"plugin": true,
"reflect": true,
"regexp": true,
"regexp/syntax": true,
"regexp/testdata": true,
"runtime": true,
"runtime/cgo": true,
"runtime/debug": true,
"runtime/internal/atomic": true,
"runtime/internal/math": true,
"runtime/internal/sys": true,
"runtime/msan": true,
"runtime/pprof": true,
"runtime/pprof/internal/profile": true,
"runtime/pprof/testdata": true,
"runtime/pprof/testdata/mappingtest": true,
"runtime/race": true,
"runtime/race/testdata": true,
"runtime/testdata/testprog": true,
"runtime/testdata/testprogcgo": true,
"runtime/testdata/testprogcgo/windows": true,
"runtime/testdata/testprognet": true,
"runtime/trace": true,
"sort": true,
"strconv": true,
"strconv/testdata": true,
"strings": true,
"sync": true,
"sync/atomic": true,
"syscall": true,
"syscall/js": true,
"testdata": true,
"testing": true,
"testing/internal/testdeps": true,
"testing/iotest": true,
"testing/quick": true,
"text/scanner": true,
"text/tabwriter": true,
"text/template": true,
"text/template/parse": true,
"text/template/testdata": true,
"time": true,
"unicode": true,
"unicode/utf16": true,
"unicode/utf8": true,
"unsafe": true,
"vendor": true,
"vendor/golang.org/x/crypto": true,
"vendor/golang.org/x/crypto/chacha20poly1305": true,
"vendor/golang.org/x/crypto/cryptobyte": true,
"vendor/golang.org/x/crypto/cryptobyte/asn1": true,
"vendor/golang.org/x/crypto/curve25519": true,
"vendor/golang.org/x/crypto/hkdf": true,
"vendor/golang.org/x/crypto/internal/chacha20": true,
"vendor/golang.org/x/crypto/internal/subtle": true,
"vendor/golang.org/x/crypto/poly1305": true,
"vendor/golang.org/x/net": true,
"vendor/golang.org/x/net/dns/dnsmessage": true,
"vendor/golang.org/x/net/http/httpguts": true,
"vendor/golang.org/x/net/http/httpproxy": true,
"vendor/golang.org/x/net/http2/hpack": true,
"vendor/golang.org/x/net/idna": true,
"vendor/golang.org/x/net/lif": true,
"vendor/golang.org/x/net/nettest": true,
"vendor/golang.org/x/net/route": true,
"vendor/golang.org/x/sys": true,
"vendor/golang.org/x/sys/cpu": true,
"vendor/golang.org/x/text": true,
"vendor/golang.org/x/text/secure/bidirule": true,
"vendor/golang.org/x/text/transform": true,
"vendor/golang.org/x/text/unicode/bidi": true,
"vendor/golang.org/x/text/unicode/norm": true,
}

View File

@@ -0,0 +1,109 @@
/* Copyright 2019 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package golang
import (
"path/filepath"
"strings"
"github.com/bazelbuild/bazel-gazelle/language"
"github.com/bazelbuild/bazel-gazelle/rule"
"golang.org/x/sync/errgroup"
)
// UpdateRepos generates go_repository rules corresponding to modules in
// args.Imports. Each module argument may specify a version with an '@' suffix
// (in the same format as 'go get'). If no version is specified, @latest
// is requested.
func (*goLang) UpdateRepos(args language.UpdateReposArgs) language.UpdateReposResult {
gen := make([]*rule.Rule, len(args.Imports))
var eg errgroup.Group
for i := range args.Imports {
i := i
eg.Go(func() error {
arg := args.Imports[i]
modPath, query := arg, "latest"
if i := strings.IndexByte(arg, '@'); i >= 0 {
modPath, query = arg[:i], arg[i+1:]
}
name, version, sum, err := args.Cache.ModVersion(modPath, query)
if err != nil {
return err
}
gen[i] = rule.NewRule("go_repository", name)
gen[i].SetAttr("importpath", modPath)
gen[i].SetAttr("version", version)
gen[i].SetAttr("sum", sum)
setBuildAttrs(getGoConfig(args.Config), gen[i])
return nil
})
}
if err := eg.Wait(); err != nil {
return language.UpdateReposResult{Error: err}
}
return language.UpdateReposResult{Gen: gen}
}
var repoImportFuncs = map[string]func(args language.ImportReposArgs) language.ImportReposResult{
"Gopkg.lock": importReposFromDep,
"go.mod": importReposFromModules,
"Godeps.json": importReposFromGodep,
}
func (*goLang) CanImport(path string) bool {
return repoImportFuncs[filepath.Base(path)] != nil
}
func (*goLang) ImportRepos(args language.ImportReposArgs) language.ImportReposResult {
res := repoImportFuncs[filepath.Base(args.Path)](args)
for _, r := range res.Gen {
setBuildAttrs(getGoConfig(args.Config), r)
}
if args.Prune {
genNamesSet := make(map[string]bool)
for _, r := range res.Gen {
genNamesSet[r.Name()] = true
}
for _, r := range args.Config.Repos {
if name := r.Name(); r.Kind() == "go_repository" && !genNamesSet[name] {
res.Empty = append(res.Empty, rule.NewRule("go_repository", name))
}
}
}
return res
}
func setBuildAttrs(gc *goConfig, r *rule.Rule) {
if gc.buildExternalAttr != "" {
r.SetAttr("build_external", gc.buildExternalAttr)
}
if gc.buildFileNamesAttr != "" {
r.SetAttr("build_file_name", gc.buildFileNamesAttr)
}
if gc.buildFileGenerationAttr != "" {
r.SetAttr("build_file_generation", gc.buildFileGenerationAttr)
}
if gc.buildTagsAttr != "" {
r.SetAttr("build_tags", gc.buildTagsAttr)
}
if gc.buildFileProtoModeAttr != "" {
r.SetAttr("build_file_proto_mode", gc.buildFileProtoModeAttr)
}
if gc.buildExtraArgsAttr != "" {
extraArgs := strings.Split(gc.buildExtraArgsAttr, ",")
r.SetAttr("build_extra_args", extraArgs)
}
}

View File

@@ -0,0 +1,151 @@
/* Copyright 2018 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Package language provides an interface for language extensions in Gazelle.
// Support for a new language can be added by defining a package with a
// function named "New" that returns a value assignable to this interface.
//
// TODO(jayconrod): document how to incorporate languages into a gazelle
// binary that can be run by Bazel.
package language
import (
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/resolve"
"github.com/bazelbuild/bazel-gazelle/rule"
)
// Language describes an extension for Gazelle that provides support for
// a set of Bazel rules.
//
// Languages are used primarily by the fix and update commands. The order
// in which languages are used matters, since languages may depend on
// one another. For example, go depends on proto, since go_proto_libraries
// are generated from metadata stored in proto_libraries.
//
// A single instance of Language is created for each fix / update run. Some
// state may be stored in this instance, but stateless behavior is encouraged,
// especially since some operations may be concurrent in the future.
//
// Tasks languages are used for
//
// * Configuration (embedded interface config.Configurer). Languages may
// define command line flags and alter the configuration in a directory
// based on directives in build files.
//
// * Fixing deprecated usage of rules in build files.
//
// * Generating rules from source files in a directory.
//
// * Resolving library imports (embedded interface resolve.Resolver). For
// example, import strings like "github.com/foo/bar" in Go can be resolved
// into Bazel labels like "@com_github_foo_bar//:go_default_library".
//
// Tasks languages support
//
// * Generating load statements: languages list files and symbols that may
// be loaded.
//
// * Merging generated rules into existing rules: languages provide metadata
// that helps with rule matching, merging, and deletion.
type Language interface {
// TODO(jayconrod): is embedding Configurer strictly necessary?
config.Configurer
resolve.Resolver
// Kinds returns a map of maps rule names (kinds) and information on how to
// match and merge attributes that may be found in rules of those kinds. All
// kinds of rules generated for this language may be found here.
Kinds() map[string]rule.KindInfo
// Loads returns .bzl files and symbols they define. Every rule generated by
// GenerateRules, now or in the past, should be loadable from one of these
// files.
Loads() []rule.LoadInfo
// GenerateRules extracts build metadata from source files in a directory.
// GenerateRules is called in each directory where an update is requested
// in depth-first post-order.
//
// args contains the arguments for GenerateRules. This is passed as a
// struct to avoid breaking implementations in the future when new
// fields are added.
//
// A GenerateResult struct is returned. Optional fields may be added to this
// type in the future.
//
// Any non-fatal errors this function encounters should be logged using
// log.Print.
GenerateRules(args GenerateArgs) GenerateResult
// Fix repairs deprecated usage of language-specific rules in f. This is
// called before the file is indexed. Unless c.ShouldFix is true, fixes
// that delete or rename rules should not be performed.
Fix(c *config.Config, f *rule.File)
}
// GenerateArgs contains arguments for language.GenerateRules. Arguments are
// passed in a struct value so that new fields may be added in the future
// without breaking existing implementations.
type GenerateArgs struct {
// Config is the configuration for the directory where rules are being
// generated.
Config *config.Config
// Dir is the canonical absolute path to the directory.
Dir string
// Rel is the slash-separated path to the directory, relative to the
// repository root ("" for the root directory itself). This may be used
// as the package name in labels.
Rel string
// File is the build file for the directory. File is nil if there is
// no existing build file.
File *rule.File
// Subdirs is a list of subdirectories in the directory, including
// symbolic links to directories that Gazelle will follow.
// RegularFiles is a list of regular files including other symbolic
// links.
// GeneratedFiles is a list of generated files in the directory
// (usually these are mentioned as "out" or "outs" attributes in rules).
Subdirs, RegularFiles, GenFiles []string
// OtherEmpty is a list of empty rules generated by other languages.
// OtherGen is a list of generated rules generated by other languages.
OtherEmpty, OtherGen []*rule.Rule
}
// GenerateResult contains return values for language.GenerateRules.
// Results are returned through a struct value so that new (optional)
// fields may be added without breaking existing implementations.
type GenerateResult struct {
// Gen is a list of rules generated from files found in the directory
// GenerateRules was asked to process. These will be merged with existing
// rules or added to the build file.
Gen []*rule.Rule
// Empty is a list of rules that cannot be built with the files found in the
// directory GenerateRules was asked to process. These will be merged with
// existing rules. If ther merged rules are empty, they will be deleted.
Empty []*rule.Rule
// Imports contains information about the imported libraries for each
// rule in Gen. Gen and Imports must have the same length, since they
// correspond. These values are passed to Resolve after merge. The type
// is opaque since different languages may use different representations.
Imports []interface{}
}

View File

@@ -0,0 +1,42 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"config.go",
"constants.go",
"fileinfo.go",
"fix.go",
"generate.go",
"kinds.go",
"known_imports.go",
"lang.go",
"package.go",
"resolve.go",
],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/language/proto",
importpath = "github.com/bazelbuild/bazel-gazelle/language/proto",
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/bazelbuild/bazel-gazelle/config:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/label:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/language:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/repo:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/resolve:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/rule:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -20,9 +20,10 @@ import (
"fmt"
"log"
"path"
"strings"
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/rule"
)
// ProtoConfig contains configuration values related to protos.
@@ -46,10 +47,26 @@ type ProtoConfig struct {
// groupOption is an option name that Gazelle will use to group .proto
// files into proto_library rules. If unset, the proto package name is used.
groupOption string
// stripImportPrefix The prefix to strip from the paths of the .proto files.
// If set, Gazelle will apply this value to the strip_import_prefix attribute
// within the proto_library_rule.
stripImportPrefix string
// importPrefix The prefix to add to the paths of the .proto files.
// If set, Gazelle will apply this value to the import_prefix attribute
// within the proto_library_rule.
importPrefix string
}
// GetProtoConfig returns the proto language configuration. If the proto
// extension was not run, it will return nil.
func GetProtoConfig(c *config.Config) *ProtoConfig {
return c.Exts[protoName].(*ProtoConfig)
pc := c.Exts[protoName]
if pc == nil {
return nil
}
return pc.(*ProtoConfig)
}
// Mode determines how proto rules are generated.
@@ -168,6 +185,7 @@ func (_ *protoLang) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config
// this is set for compatibility with older versions.
fs.Var(&modeFlag{&pc.Mode}, "proto", "default: generates a proto_library rule for one package\n\tpackage: generates a proto_library rule for for each package\n\tdisable: does not touch proto rules\n\tdisable_global: does not touch proto rules and does not use special cases for protos in dependency resolution")
fs.StringVar(&pc.groupOption, "proto_group", "", "option name used to group .proto files into proto_library rules")
fs.StringVar(&pc.importPrefix, "proto_import_prefix", "", "When set, .proto source files in the srcs attribute of the rule are accessible at their path with this prefix appended on.")
}
func (_ *protoLang) CheckFlags(fs *flag.FlagSet, c *config.Config) error {
@@ -175,7 +193,7 @@ func (_ *protoLang) CheckFlags(fs *flag.FlagSet, c *config.Config) error {
}
func (_ *protoLang) KnownDirectives() []string {
return []string{"proto", "proto_group"}
return []string{"proto", "proto_group", "proto_strip_import_prefix", "proto_import_prefix"}
}
func (_ *protoLang) Configure(c *config.Config, rel string, f *rule.File) {
@@ -195,6 +213,15 @@ func (_ *protoLang) Configure(c *config.Config, rel string, f *rule.File) {
pc.ModeExplicit = true
case "proto_group":
pc.groupOption = d.Value
case "proto_strip_import_prefix":
pc.stripImportPrefix = d.Value
if rel != "" {
if err := checkStripImportPrefix(pc.stripImportPrefix, rel); err != nil {
log.Print(err)
}
}
case "proto_import_prefix":
pc.importPrefix = d.Value
}
}
}
@@ -248,3 +275,10 @@ outer:
}
pc.Mode = mode
}
func checkStripImportPrefix(prefix, rel string) error {
if !strings.HasPrefix(prefix, "/") || !strings.HasPrefix(rel, prefix[1:]) {
return fmt.Errorf("invalid proto_strip_import_prefix %q at %s", prefix, rel)
}
return nil
}

View File

@@ -16,8 +16,8 @@ limitations under the License.
package proto
import (
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/rule"
)
func (_ *protoLang) Fix(c *config.Config, f *rule.File) {

View File

@@ -21,45 +21,52 @@ import (
"sort"
"strings"
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/language"
"github.com/bazelbuild/bazel-gazelle/rule"
)
func (_ *protoLang) GenerateRules(c *config.Config, dir, rel string, f *rule.File, subdirs, regularFiles, genFiles []string, otherEmpty, otherGen []*rule.Rule) (empty, gen []*rule.Rule) {
func (_ *protoLang) GenerateRules(args language.GenerateArgs) language.GenerateResult {
c := args.Config
pc := GetProtoConfig(c)
if !pc.Mode.ShouldGenerateRules() {
// Don't create or delete proto rules in this mode. Any existing rules
// are likely hand-written.
return nil, nil
return language.GenerateResult{}
}
var regularProtoFiles []string
for _, name := range regularFiles {
for _, name := range args.RegularFiles {
if strings.HasSuffix(name, ".proto") {
regularProtoFiles = append(regularProtoFiles, name)
}
}
var genProtoFiles []string
for _, name := range genFiles {
for _, name := range args.GenFiles {
if strings.HasSuffix(name, ".proto") {
genProtoFiles = append(genFiles, name)
genProtoFiles = append(genProtoFiles, name)
}
}
pkgs := buildPackages(pc, dir, rel, regularProtoFiles, genProtoFiles)
shouldSetVisibility := !hasDefaultVisibility(f)
pkgs := buildPackages(pc, args.Dir, args.Rel, regularProtoFiles, genProtoFiles)
shouldSetVisibility := args.File == nil || !args.File.HasDefaultVisibility()
var res language.GenerateResult
for _, pkg := range pkgs {
r := generateProto(pc, rel, pkg, shouldSetVisibility)
r := generateProto(pc, args.Rel, pkg, shouldSetVisibility)
if r.IsEmpty(protoKinds[r.Kind()]) {
empty = append(empty, r)
res.Empty = append(res.Empty, r)
} else {
gen = append(gen, r)
res.Gen = append(res.Gen, r)
}
}
sort.SliceStable(gen, func(i, j int) bool {
return gen[i].Name() < gen[j].Name()
sort.SliceStable(res.Gen, func(i, j int) bool {
return res.Gen[i].Name() < res.Gen[j].Name()
})
empty = append(empty, generateEmpty(f, regularProtoFiles, genProtoFiles)...)
return empty, gen
res.Imports = make([]interface{}, len(res.Gen))
for i, r := range res.Gen {
res.Imports[i] = r.PrivateAttr(config.GazelleImportsKey)
}
res.Empty = append(res.Empty, generateEmpty(args.File, regularProtoFiles, genProtoFiles)...)
return res
}
// RuleName returns a name for a proto_library derived from the given strings.
@@ -203,14 +210,22 @@ func generateProto(pc *ProtoConfig, rel string, pkg *Package, shouldSetVisibilit
imports = append(imports, i)
}
sort.Strings(imports)
// NOTE: This attribute should not be used outside this extension. It's still
// convenient for testing though.
r.SetPrivateAttr(config.GazelleImportsKey, imports)
for k, v := range pkg.Options {
r.SetPrivateAttr(k, v)
}
if shouldSetVisibility {
vis := checkInternalVisibility(rel, "//visibility:public")
vis := rule.CheckInternalVisibility(rel, "//visibility:public")
r.SetAttr("visibility", []string{vis})
}
if pc.stripImportPrefix != "" {
r.SetAttr("strip_import_prefix", pc.stripImportPrefix)
}
if pc.importPrefix != "" {
r.SetAttr("import_prefix", pc.importPrefix)
}
return r
}
@@ -248,29 +263,3 @@ outer:
}
return empty
}
// hasDefaultVisibility returns whether oldFile contains a "package" rule with
// a "default_visibility" attribute. Rules generated by Gazelle should not
// have their own visibility attributes if this is the case.
func hasDefaultVisibility(f *rule.File) bool {
if f == nil {
return false
}
for _, r := range f.Rules {
if r.Kind() == "package" && r.Attr("default_visibility") != nil {
return true
}
}
return false
}
// checkInternalVisibility overrides the given visibility if the package is
// internal.
func checkInternalVisibility(rel, visibility string) string {
if i := strings.LastIndex(rel, "/internal/"); i >= 0 {
visibility = fmt.Sprintf("//%s:__subpackages__", rel[:i])
} else if strings.HasPrefix(rel, "internal/") {
visibility = "//:__subpackages__"
}
return visibility
}

View File

@@ -15,13 +15,15 @@ limitations under the License.
package proto
import "github.com/bazelbuild/bazel-gazelle/internal/rule"
import "github.com/bazelbuild/bazel-gazelle/rule"
var protoKinds = map[string]rule.KindInfo{
"proto_library": {
NonEmptyAttrs: map[string]bool{"srcs": true},
MergeableAttrs: map[string]bool{"srcs": true},
ResolveAttrs: map[string]bool{"deps": true},
NonEmptyAttrs: map[string]bool{"srcs": true},
MergeableAttrs: map[string]bool{
"srcs": true,
},
ResolveAttrs: map[string]bool{"deps": true},
},
}

File diff suppressed because it is too large Load Diff

View File

@@ -59,7 +59,7 @@ limitations under the License.
// @com_google_protobuf.
package proto
import "github.com/bazelbuild/bazel-gazelle/internal/language"
import "github.com/bazelbuild/bazel-gazelle/language"
const protoName = "proto"
@@ -67,6 +67,6 @@ type protoLang struct{}
func (_ *protoLang) Name() string { return protoName }
func New() language.Language {
func NewLanguage() language.Language {
return &protoLang{}
}

File diff suppressed because it is too large Load Diff

View File

@@ -23,19 +23,30 @@ import (
"sort"
"strings"
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/label"
"github.com/bazelbuild/bazel-gazelle/internal/repos"
"github.com/bazelbuild/bazel-gazelle/internal/resolve"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/label"
"github.com/bazelbuild/bazel-gazelle/repo"
"github.com/bazelbuild/bazel-gazelle/resolve"
"github.com/bazelbuild/bazel-gazelle/rule"
)
func (_ *protoLang) Imports(c *config.Config, r *rule.Rule, f *rule.File) []resolve.ImportSpec {
rel := f.Pkg
srcs := r.AttrStrings("srcs")
imports := make([]resolve.ImportSpec, len(srcs))
pc := GetProtoConfig(c)
prefix := rel
if pc.stripImportPrefix != "" {
prefix = strings.TrimPrefix(rel, pc.stripImportPrefix[1:])
if rel == prefix {
return nil
}
}
if pc.importPrefix != "" {
prefix = path.Join(pc.importPrefix, prefix)
}
for i, src := range srcs {
imports[i] = resolve.ImportSpec{Lang: "proto", Imp: path.Join(rel, src)}
imports[i] = resolve.ImportSpec{Lang: "proto", Imp: path.Join(prefix, src)}
}
return imports
}
@@ -44,8 +55,7 @@ func (_ *protoLang) Embeds(r *rule.Rule, from label.Label) []label.Label {
return nil
}
func (_ *protoLang) Resolve(c *config.Config, ix *resolve.RuleIndex, rc *repos.RemoteCache, r *rule.Rule, from label.Label) {
importsRaw := r.PrivateAttr(config.GazelleImportsKey)
func (_ *protoLang) Resolve(c *config.Config, ix *resolve.RuleIndex, rc *repo.RemoteCache, r *rule.Rule, importsRaw interface{}, from label.Label) {
if importsRaw == nil {
// may not be set in tests.
return

View File

@@ -0,0 +1,120 @@
/* Copyright 2019 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package language
import (
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/repo"
"github.com/bazelbuild/bazel-gazelle/rule"
)
// RepoUpdater may be implemented by languages that support updating
// repository rules that provide named libraries.
//
// EXPERIMENTAL: this may change or be removed.
type RepoUpdater interface {
UpdateRepos(args UpdateReposArgs) UpdateReposResult
}
// UpdateReposArgs contains arguments for RepoUpdater.UpdateRepos.
// Arguments are passed in a struct value so that new fields may be added
// in the future without breaking existing implementations.
//
// EXPERIMENTAL: this may change or be removed.
type UpdateReposArgs struct {
// Config is the configuration for the main workspace.
Config *config.Config
// Imports is a list of libraries to update. UpdateRepos should return
// repository rules that provide these libraries. It may also return
// repository rules providing transitive dependencies.
Imports []string
// Cache stores information fetched from the network and ensures that
// the same request isn't made multiple times.
Cache *repo.RemoteCache
}
// UpdateReposResult contains return values for RepoUpdater.UpdateRepos.
// Results are returned through a struct so that new (optional) fields may be
// added without breaking existing implementations.
//
// EXPERIMENTAL: this may change or be removed.
type UpdateReposResult struct {
// Gen is a list of repository rules that provide libraries named by
// UpdateImportArgs.Imports. These will be merged with existing rules or
// added to WORKSPACE. This list may be shorter or longer than the list
// of imports, since a single repository may provide multiple imports,
// and additional repositories may be needed for transitive dependencies.
Gen []*rule.Rule
// Error is any fatal error that occurred. Non-fatal errors should be logged.
Error error
}
// RepoImporter may be implemented by languages that support importing
// repository rules from another build system.
//
// EXPERIMENTAL: this may change or be removed.
type RepoImporter interface {
// CanImport returns whether a given configuration file may be imported
// with this extension. Only one extension may import any given file.
// ImportRepos will not be called unless this returns true.
CanImport(path string) bool
// ImportRepos generates a list of repository rules by reading a
// configuration file from another build system.
ImportRepos(args ImportReposArgs) ImportReposResult
}
// ImportReposArgs contains arguments for RepoImporter.ImportRepos.
// Arguments are passed in a struct value so that new fields may be added
// in the future without breaking existing implementations.
//
// EXPERIMENTAL: this may change or be removed.
type ImportReposArgs struct {
// Config is the configuration for the main workspace.
Config *config.Config
// Path is the name of the configuration file to import.
Path string
// Prune indicates whether repository rules that are no longer needed
// should be deleted. This means the Empty list in the result should be
// filled in.
Prune bool
// Cache stores information fetched from the network and ensures that
// the same request isn't made multiple times.
Cache *repo.RemoteCache
}
// ImportReposResult contains return values for RepoImporter.ImportRepos.
// Results are returned through a struct so that new (optional) fields may
// be added without breaking existing implementations.
//
// EXPERIMENTAL: this may change or be removed.
type ImportReposResult struct {
// Gen is a list of imported repository rules.
Gen []*rule.Rule
// Empty is a list of repository rules that may be deleted. This should only
// be set if ImportReposArgs.Prune is true.
Empty []*rule.Rule
// Error is any fatal error that occurred. Non-fatal errors should be logged.
Error error
}

View File

@@ -6,10 +6,10 @@ go_library(
"fix.go",
"merger.go",
],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/internal/merger",
importpath = "github.com/bazelbuild/bazel-gazelle/internal/merger",
visibility = ["//vendor/github.com/bazelbuild/bazel-gazelle:__subpackages__"],
deps = ["//vendor/github.com/bazelbuild/bazel-gazelle/internal/rule:go_default_library"],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/merger",
importpath = "github.com/bazelbuild/bazel-gazelle/merger",
visibility = ["//visibility:public"],
deps = ["//vendor/github.com/bazelbuild/bazel-gazelle/rule:go_default_library"],
)
filegroup(

View File

@@ -19,7 +19,7 @@ import (
"fmt"
"strings"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/rule"
)
// FixLoads removes loads of unused go rules and adds loads of newly used rules.
@@ -139,12 +139,6 @@ func newLoadIndex(f *rule.File, after []string) int {
return index
}
// FixWorkspace updates rules in the WORKSPACE file f that were used with an
// older version of rules_go or gazelle.
func FixWorkspace(f *rule.File) {
removeLegacyGoRepository(f)
}
// CheckGazelleLoaded searches the given WORKSPACE file for a repository named
// "bazel_gazelle". If no such repository is found *and* the repo is not
// declared with a directive *and* at least one load statement mentions
@@ -183,17 +177,3 @@ by adding a comment like this to WORKSPACE:
# gazelle:repo bazel_gazelle
`, f.Path)
}
// removeLegacyGoRepository removes loads of go_repository from
// @io_bazel_rules_go. FixLoads should be called after this; it will load from
// @bazel_gazelle.
func removeLegacyGoRepository(f *rule.File) {
for _, l := range f.Loads {
if l.Name() == "@io_bazel_rules_go//go:def.bzl" {
l.Remove("go_repository")
if l.IsEmpty() {
l.Delete()
}
}
}
}

View File

@@ -13,37 +13,88 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package merger provides methods for merging parsed BUILD files.
// Package merger provides functions for merging generated rules into
// existing build files.
//
// Gazelle's normal workflow is roughly as follows:
//
// 1. Read metadata from sources.
//
// 2. Generate new rules.
//
// 3. Merge newly generated rules with rules in the existing build file
// if there is one.
//
// 4. Build an index of merged library rules for dependency resolution.
//
// 5. Resolve dependencies (i.e., convert import strings to deps labels).
//
// 6. Merge the newly resolved dependencies.
//
// 7. Write the merged file back to disk.
//
// This package is used for sets 3 and 6 above.
package merger
import (
"fmt"
"strings"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/rule"
)
// Phase indicates which attributes should be merged in matching rules.
//
// The pre-resolve merge is performed before rules are indexed for dependency
// resolution. All attributes not related to dependencies are merged. This
// merge must be performed indexing because attributes related to indexing
// (e.g., srcs, importpath) will be affected.
//
// The post-resolve merge is performed after rules are indexed. All attributes
// related to dependencies are merged.
type Phase int
const (
// The pre-resolve merge is performed before rules are indexed for dependency
// resolution. All attributes not related to dependencies are merged
// (i.e., rule.KindInfo.MergeableAttrs). This merge must be performed
// before indexing because attributes related to indexing (e.g.,
// srcs, importpath) will be affected.
PreResolve Phase = iota
// The post-resolve merge is performed after rules are indexed. All attributes
// related to dependencies are merged (i.e., rule.KindInfo.ResolveAttrs).
PostResolve
)
// MergeFile merges the rules in genRules with matching rules in f and
// adds unmatched rules to the end of the merged file. MergeFile also merges
// rules in empty with matching rules in f and deletes rules that
// are empty after merging. attrs is the set of attributes to merge. Attributes
// not in this set will be left alone if they already exist.
// MergeFile combines information from newly generated rules with matching
// rules in an existing build file. MergeFile can also delete rules which
// are empty after merging.
//
// oldFile is the file to merge. It must not be nil.
//
// emptyRules is a list of stub rules (with no attributes other than name)
// which were not generated. These are merged with matching rules. The merged
// rules are deleted if they contain no attributes that make them buildable
// (e.g., srcs, deps, anything in rule.KindInfo.NonEmptyAttrs).
//
// genRules is a list of newly generated rules. These are merged with
// matching rules. A rule matches if it has the same kind and name or if
// some other attribute in rule.KindInfo.MatchAttrs matches (e.g.,
// "importpath" in go_library). Elements of genRules that don't match
// any existing rule are appended to the end of oldFile.
//
// phase indicates whether this is a pre- or post-resolve merge. Different
// attributes (rule.KindInfo.MergeableAttrs or ResolveAttrs) will be merged.
//
// kinds maps rule kinds (e.g., "go_library") to metadata that helps merge
// rules of that kind.
//
// When a generated and existing rule are merged, each attribute is merged
// separately. If an attribute is mergeable (according to KindInfo), values
// from the existing attribute are replaced by values from the generated
// attribute. Comments are preserved on values that are present in both
// versions of the attribute. If at attribute is not mergeable, the generated
// version of the attribute will be added if no existing attribute is present;
// otherwise, the existing attribute will be preserved.
//
// Note that "# keep" comments affect merging. If a value within an existing
// attribute is marked with a "# keep" comment, it will not be removed.
// If an attribute is marked with a "# keep" comment, it will not be merged.
// If a rule is marked with a "# keep" comment, the whole rule will not
// be modified.
func MergeFile(oldFile *rule.File, emptyRules, genRules []*rule.Rule, phase Phase, kinds map[string]rule.KindInfo) {
getMergeAttrs := func(r *rule.Rule) map[string]bool {
if phase == PreResolve {
@@ -55,7 +106,7 @@ func MergeFile(oldFile *rule.File, emptyRules, genRules []*rule.Rule, phase Phas
// Merge empty rules into the file and delete any rules which become empty.
for _, emptyRule := range emptyRules {
if oldRule, _ := match(oldFile.Rules, emptyRule, kinds[emptyRule.Kind()]); oldRule != nil {
if oldRule, _ := Match(oldFile.Rules, emptyRule, kinds[emptyRule.Kind()]); oldRule != nil {
if oldRule.ShouldKeep() {
continue
}
@@ -73,7 +124,7 @@ func MergeFile(oldFile *rule.File, emptyRules, genRules []*rule.Rule, phase Phas
matchErrors := make([]error, len(genRules))
substitutions := make(map[string]string)
for i, genRule := range genRules {
oldRule, err := match(oldFile.Rules, genRule, kinds[genRule.Kind()])
oldRule, err := Match(oldFile.Rules, genRule, kinds[genRule.Kind()])
if err != nil {
// TODO(jayconrod): add a verbose mode and log errors. They are too chatty
// to print by default.
@@ -128,7 +179,7 @@ func substituteRule(r *rule.Rule, substitutions map[string]string, info rule.Kin
}
}
// match searches for a rule that can be merged with x in rules.
// Match searches for a rule that can be merged with x in rules.
//
// A rule is considered a match if its kind is equal to x's kind AND either its
// name is equal OR at least one of the attributes in matchAttrs is equal.
@@ -144,7 +195,7 @@ func substituteRule(r *rule.Rule, substitutions map[string]string, info rule.Kin
// the quality of the match (name match is best, then attribute match in the
// order that attributes are listed). If disambiguation is successful,
// the rule and nil are returned. Otherwise, nil and an error are returned.
func match(rules []*rule.Rule, x *rule.Rule, info rule.KindInfo) (*rule.Rule, error) {
func Match(rules []*rule.Rule, x *rule.Rule, info rule.KindInfo) (*rule.Rule, error) {
xname := x.Name()
xkind := x.Kind()
var nameMatches []*rule.Rule

View File

@@ -3,9 +3,9 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["path.go"],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/internal/pathtools",
importpath = "github.com/bazelbuild/bazel-gazelle/internal/pathtools",
visibility = ["//vendor/github.com/bazelbuild/bazel-gazelle:__subpackages__"],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/pathtools",
importpath = "github.com/bazelbuild/bazel-gazelle/pathtools",
visibility = ["//visibility:public"],
)
filegroup(

View File

@@ -13,6 +13,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package pathtools provides utilities for manipulating paths. Most paths
// within Gazelle are slash-separated paths, relative to the repository root
// directory. The repository root directory is represented by the empty
// string. Paths in this format may be used directly as package names in labels.
package pathtools
import (
@@ -61,3 +65,47 @@ func RelBaseName(rel, prefix, root string) string {
}
return base
}
// Index returns the starting index of the string sub within the non-absolute
// slash-separated path p. sub must start and end at component boundaries
// within p.
func Index(p, sub string) int {
if sub == "" {
return 0
}
p = path.Clean(p)
sub = path.Clean(sub)
if path.IsAbs(sub) {
if HasPrefix(p, sub) {
return 0
} else {
return -1
}
}
if p == "" || p == "/" {
return -1
}
i := 0 // i is the index of the first byte of a path element
if len(p) > 0 && p[0] == '/' {
i++
}
for {
suffix := p[i:]
if len(suffix) < len(sub) {
return -1
}
if suffix[:len(sub)] == sub && (len(suffix) == len(sub) || suffix[len(sub)] == '/') {
return i
}
j := strings.IndexByte(suffix, '/')
if j < 0 {
return -1
}
i += j + 1
if i >= len(p) {
return -1
}
}
return -1
}

View File

@@ -3,19 +3,16 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"dep.go",
"modules.go",
"remote.go",
"repo.go",
],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/internal/repos",
importpath = "github.com/bazelbuild/bazel-gazelle/internal/repos",
visibility = ["//vendor/github.com/bazelbuild/bazel-gazelle:__subpackages__"],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/repo",
importpath = "github.com/bazelbuild/bazel-gazelle/repo",
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/label:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/pathtools:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/rule:go_default_library",
"//vendor/github.com/pelletier/go-toml:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/label:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/pathtools:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/rule:go_default_library",
"//vendor/golang.org/x/tools/go/vcs:go_default_library",
],
)

View File

@@ -0,0 +1,583 @@
/* Copyright 2018 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package repo
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path"
"path/filepath"
"regexp"
"runtime"
"strings"
"sync"
"github.com/bazelbuild/bazel-gazelle/label"
"github.com/bazelbuild/bazel-gazelle/pathtools"
"golang.org/x/tools/go/vcs"
)
// RemoteCache stores information about external repositories. The cache may
// be initialized with information about known repositories, i.e., those listed
// in the WORKSPACE file and mentioned on the command line. Other information
// is retrieved over the network.
//
// Public methods of RemoteCache may be slow in cases where a network fetch
// is needed. Public methods may be called concurrently.
//
// TODO(jayconrod): this is very Go-centric. It should be moved to language/go.
// Unfortunately, doing so would break the resolve.Resolver interface.
type RemoteCache struct {
// RepoRootForImportPath is vcs.RepoRootForImportPath by default. It may
// be overridden so that tests may avoid accessing the network.
RepoRootForImportPath func(string, bool) (*vcs.RepoRoot, error)
// HeadCmd returns the latest commit on the default branch in the given
// repository. This is used by Head. It may be stubbed out for tests.
HeadCmd func(remote, vcs string) (string, error)
// ModInfo returns the module path and version that provides the package
// with the given import path. This is used by Mod. It may be stubbed
// out for tests.
ModInfo func(importPath string) (modPath string, err error)
// ModVersionInfo returns the module path, true version, and sum for
// the module that provides the package with the given import path.
// This is used by ModVersion. It may be stubbed out for tests.
ModVersionInfo func(modPath, query string) (version, sum string, err error)
root, remote, head, mod, modVersion remoteCacheMap
tmpOnce sync.Once
tmpDir string
tmpErr error
}
// remoteCacheMap is a thread-safe, idempotent cache. It is used to store
// information which should be fetched over the network no more than once.
// This follows the Memo pattern described in The Go Programming Language,
// section 9.7.
type remoteCacheMap struct {
mu sync.Mutex
cache map[string]*remoteCacheEntry
}
type remoteCacheEntry struct {
value interface{}
err error
// ready is nil for entries that were added when the cache was initialized.
// It is non-nil for other entries. It is closed when an entry is ready,
// i.e., the operation loading the entry completed.
ready chan struct{}
}
type rootValue struct {
root, name string
}
type remoteValue struct {
remote, vcs string
}
type headValue struct {
commit, tag string
}
type modValue struct {
path, name string
known bool
}
type modVersionValue struct {
path, name, version, sum string
}
// Repo describes details of a Go repository known in advance. It is used to
// initialize RemoteCache so that some repositories don't need to be looked up.
//
// DEPRECATED: Go-specific details should be removed from RemoteCache, and
// lookup logic should be moved to language/go. This means RemoteCache will
// need to be initialized in a different way.
type Repo struct {
Name, GoPrefix, Remote, VCS string
}
// NewRemoteCache creates a new RemoteCache with a set of known repositories.
// The Root and Remote methods will return information about repositories listed
// here without accessing the network. However, the Head method will still
// access the network for these repositories to retrieve information about new
// versions.
//
// A cleanup function is also returned. The caller must call this when
// RemoteCache is no longer needed. RemoteCache may write files to a temporary
// directory. This will delete them.
func NewRemoteCache(knownRepos []Repo) (r *RemoteCache, cleanup func() error) {
r = &RemoteCache{
RepoRootForImportPath: vcs.RepoRootForImportPath,
HeadCmd: defaultHeadCmd,
root: remoteCacheMap{cache: make(map[string]*remoteCacheEntry)},
remote: remoteCacheMap{cache: make(map[string]*remoteCacheEntry)},
head: remoteCacheMap{cache: make(map[string]*remoteCacheEntry)},
mod: remoteCacheMap{cache: make(map[string]*remoteCacheEntry)},
modVersion: remoteCacheMap{cache: make(map[string]*remoteCacheEntry)},
}
r.ModInfo = func(importPath string) (string, error) {
return defaultModInfo(r, importPath)
}
r.ModVersionInfo = func(modPath, query string) (string, string, error) {
return defaultModVersionInfo(r, modPath, query)
}
for _, repo := range knownRepos {
r.root.cache[repo.GoPrefix] = &remoteCacheEntry{
value: rootValue{
root: repo.GoPrefix,
name: repo.Name,
},
}
if repo.Remote != "" {
r.remote.cache[repo.GoPrefix] = &remoteCacheEntry{
value: remoteValue{
remote: repo.Remote,
vcs: repo.VCS,
},
}
}
r.mod.cache[repo.GoPrefix] = &remoteCacheEntry{
value: modValue{
path: repo.GoPrefix,
name: repo.Name,
known: true,
},
}
}
// Augment knownRepos with additional prefixes for
// minimal module compatibility. For example, if repo "com_example_foo_v2"
// has prefix "example.com/foo/v2", map "example.com/foo" to the same
// entry.
// TODO(jayconrod): there should probably be some control over whether
// callers can use these mappings: packages within modules should not be
// allowed to use them. However, we'll return the same result nearly all
// the time, and simpler is better.
for _, repo := range knownRepos {
path := pathWithoutSemver(repo.GoPrefix)
if path == "" || r.root.cache[path] != nil {
continue
}
r.root.cache[path] = r.root.cache[repo.GoPrefix]
if e := r.remote.cache[repo.GoPrefix]; e != nil {
r.remote.cache[path] = e
}
r.mod.cache[path] = r.mod.cache[repo.GoPrefix]
}
return r, r.cleanup
}
func (r *RemoteCache) cleanup() error {
if r.tmpDir == "" {
return nil
}
return os.RemoveAll(r.tmpDir)
}
var gopkginPattern = regexp.MustCompile("^(gopkg.in/(?:[^/]+/)?[^/]+\\.v\\d+)(?:/|$)")
var knownPrefixes = []struct {
prefix string
missing int
}{
{prefix: "golang.org/x", missing: 1},
{prefix: "google.golang.org", missing: 1},
{prefix: "cloud.google.com", missing: 1},
{prefix: "github.com", missing: 2},
}
// Root returns the portion of an import path that corresponds to the root
// directory of the repository containing the given import path. For example,
// given "golang.org/x/tools/go/loader", this will return "golang.org/x/tools".
// The workspace name of the repository is also returned. This may be a custom
// name set in WORKSPACE, or it may be a generated name based on the root path.
func (r *RemoteCache) Root(importPath string) (root, name string, err error) {
// Try prefixes of the import path in the cache, but don't actually go out
// to vcs yet. We do this before handling known special cases because
// the cache is pre-populated with repository rules, and we want to use their
// names if we can.
prefix := importPath
for {
v, ok, err := r.root.get(prefix)
if ok {
if err != nil {
return "", "", err
}
value := v.(rootValue)
return value.root, value.name, nil
}
prefix = path.Dir(prefix)
if prefix == "." || prefix == "/" {
break
}
}
// Try known prefixes.
for _, p := range knownPrefixes {
if pathtools.HasPrefix(importPath, p.prefix) {
rest := pathtools.TrimPrefix(importPath, p.prefix)
var components []string
if rest != "" {
components = strings.Split(rest, "/")
}
if len(components) < p.missing {
return "", "", fmt.Errorf("import path %q is shorter than the known prefix %q", importPath, p.prefix)
}
root = p.prefix
for _, c := range components[:p.missing] {
root = path.Join(root, c)
}
name = label.ImportPathToBazelRepoName(root)
return root, name, nil
}
}
// gopkg.in is special, and might have either one or two levels of
// missing paths. See http://labix.org/gopkg.in for URL patterns.
if match := gopkginPattern.FindStringSubmatch(importPath); len(match) > 0 {
root = match[1]
name = label.ImportPathToBazelRepoName(root)
return root, name, nil
}
// Find the prefix using vcs and cache the result.
v, err := r.root.ensure(importPath, func() (interface{}, error) {
res, err := r.RepoRootForImportPath(importPath, false)
if err != nil {
return nil, err
}
return rootValue{res.Root, label.ImportPathToBazelRepoName(res.Root)}, nil
})
if err != nil {
return "", "", err
}
value := v.(rootValue)
return value.root, value.name, nil
}
// Remote returns the VCS name and the remote URL for a repository with the
// given root import path. This is suitable for creating new repository rules.
func (r *RemoteCache) Remote(root string) (remote, vcs string, err error) {
v, err := r.remote.ensure(root, func() (interface{}, error) {
repo, err := r.RepoRootForImportPath(root, false)
if err != nil {
return nil, err
}
return remoteValue{remote: repo.Repo, vcs: repo.VCS.Cmd}, nil
})
if err != nil {
return "", "", err
}
value := v.(remoteValue)
return value.remote, value.vcs, nil
}
// Head returns the most recent commit id on the default branch and latest
// version tag for the given remote repository. The tag "" is returned if
// no latest version was found.
//
// TODO(jayconrod): support VCS other than git.
// TODO(jayconrod): support version tags. "" is always returned.
func (r *RemoteCache) Head(remote, vcs string) (commit, tag string, err error) {
if vcs != "git" {
return "", "", fmt.Errorf("could not locate recent commit in repo %q with unknown version control scheme %q", remote, vcs)
}
v, err := r.head.ensure(remote, func() (interface{}, error) {
commit, err := r.HeadCmd(remote, vcs)
if err != nil {
return nil, err
}
return headValue{commit: commit}, nil
})
if err != nil {
return "", "", err
}
value := v.(headValue)
return value.commit, value.tag, nil
}
func defaultHeadCmd(remote, vcs string) (string, error) {
switch vcs {
case "local":
return "", nil
case "git":
// Old versions of git ls-remote exit with code 129 when "--" is passed.
// We'll try to validate the argument here instead.
if strings.HasPrefix(remote, "-") {
return "", fmt.Errorf("remote must not start with '-': %q", remote)
}
cmd := exec.Command("git", "ls-remote", remote, "HEAD")
out, err := cmd.Output()
if err != nil {
var stdErr []byte
if e, ok := err.(*exec.ExitError); ok {
stdErr = e.Stderr
}
return "", fmt.Errorf("git ls-remote for %s : %v : %s", remote, err, stdErr)
}
ix := bytes.IndexByte(out, '\t')
if ix < 0 {
return "", fmt.Errorf("could not parse output for git ls-remote for %q", remote)
}
return string(out[:ix]), nil
default:
return "", fmt.Errorf("unknown version control system: %s", vcs)
}
}
// Mod returns the module path for the module that contains the package
// named by importPath. The name of the go_repository rule for the module
// is also returned. For example, calling Mod on "github.com/foo/bar/v2/baz"
// would give the module path "github.com/foo/bar/v2" and the name
// "com_github_foo_bar_v2".
//
// If a known repository *could* provide importPath (because its "importpath"
// is a prefix of importPath), Mod will assume that it does. This may give
// inaccurate results if importPath is in an undeclared nested module. Run
// "gazelle update-repos -from_file=go.mod" first for best results.
//
// If no known repository could provide importPath, Mod will run "go list" to
// find the module. The special patterns that Root uses are ignored. Results are
// cached. Use GOPROXY for faster results.
func (r *RemoteCache) Mod(importPath string) (modPath, name string, err error) {
// Check if any of the known repositories is a prefix.
prefix := importPath
for {
v, ok, err := r.mod.get(prefix)
if ok {
if err != nil {
return "", "", err
}
value := v.(modValue)
if value.known {
return value.path, value.name, nil
} else {
break
}
}
prefix = path.Dir(prefix)
if prefix == "." || prefix == "/" {
break
}
}
// Ask "go list".
v, err := r.mod.ensure(importPath, func() (interface{}, error) {
modPath, err := r.ModInfo(importPath)
if err != nil {
return nil, err
}
return modValue{
path: modPath,
name: label.ImportPathToBazelRepoName(modPath),
}, nil
})
if err != nil {
return "", "", err
}
value := v.(modValue)
return value.path, value.name, nil
}
func defaultModInfo(rc *RemoteCache, importPath string) (modPath string, err error) {
rc.initTmp()
if rc.tmpErr != nil {
return "", rc.tmpErr
}
goTool := findGoTool()
cmd := exec.Command(goTool, "list", "-find", "-f", "{{.Module.Path}}", "--", importPath)
cmd.Dir = rc.tmpDir
cmd.Env = append(os.Environ(), "GO111MODULE=on")
out, err := cmd.Output()
if err != nil {
var stdErr []byte
if e, ok := err.(*exec.ExitError); ok {
stdErr = e.Stderr
}
return "", fmt.Errorf("finding module path for import %s: %v: %s", importPath, err, stdErr)
}
return strings.TrimSpace(string(out)), nil
}
// ModVersion looks up information about a module at a given version.
// The path must be the module path, not a package within the module.
// The version may be a canonical semantic version, a query like "latest",
// or a branch, tag, or revision name. ModVersion returns the name of
// the repository rule providing the module (if any), the true version,
// and the sum.
func (r *RemoteCache) ModVersion(modPath, query string) (name, version, sum string, err error) {
// Ask "go list".
arg := modPath + "@" + query
v, err := r.modVersion.ensure(arg, func() (interface{}, error) {
version, sum, err := r.ModVersionInfo(modPath, query)
if err != nil {
return nil, err
}
return modVersionValue{
path: modPath,
version: version,
sum: sum,
}, nil
})
if err != nil {
return "", "", "", err
}
value := v.(modVersionValue)
// Try to find the repository name for the module, if there's already
// a repository rule that provides it.
v, ok, err := r.mod.get(modPath)
if ok && err == nil {
name = v.(modValue).name
} else {
name = label.ImportPathToBazelRepoName(modPath)
}
return name, value.version, value.sum, nil
}
func defaultModVersionInfo(rc *RemoteCache, modPath, query string) (version, sum string, err error) {
rc.initTmp()
if rc.tmpErr != nil {
return "", "", rc.tmpErr
}
goTool := findGoTool()
cmd := exec.Command(goTool, "mod", "download", "-json", "--", modPath+"@"+query)
cmd.Dir = rc.tmpDir
cmd.Env = append(os.Environ(), "GO111MODULE=on")
out, err := cmd.Output()
if err != nil {
var stdErr []byte
if e, ok := err.(*exec.ExitError); ok {
stdErr = e.Stderr
}
return "", "", fmt.Errorf("finding module version and sum for %s@%s: %v: %s", modPath, query, err, stdErr)
}
var result struct{ Version, Sum string }
if err := json.Unmarshal(out, &result); err != nil {
fmt.Println(out)
return "", "", fmt.Errorf("finding module version and sum for %s@%s: invalid output from 'go mod download': %v", modPath, query, err)
}
return result.Version, result.Sum, nil
}
// get retrieves a value associated with the given key from the cache. ok will
// be true if the key exists in the cache, even if it's in the process of
// being fetched.
func (m *remoteCacheMap) get(key string) (value interface{}, ok bool, err error) {
m.mu.Lock()
e, ok := m.cache[key]
m.mu.Unlock()
if !ok {
return nil, ok, nil
}
if e.ready != nil {
<-e.ready
}
return e.value, ok, e.err
}
// ensure retreives a value associated with the given key from the cache. If
// the key does not exist in the cache, the load function will be called,
// and its result will be associated with the key. The load function will not
// be called more than once for any key.
func (m *remoteCacheMap) ensure(key string, load func() (interface{}, error)) (interface{}, error) {
m.mu.Lock()
e, ok := m.cache[key]
if !ok {
e = &remoteCacheEntry{ready: make(chan struct{})}
m.cache[key] = e
m.mu.Unlock()
e.value, e.err = load()
close(e.ready)
} else {
m.mu.Unlock()
if e.ready != nil {
<-e.ready
}
}
return e.value, e.err
}
func (rc *RemoteCache) initTmp() {
rc.tmpOnce.Do(func() {
rc.tmpDir, rc.tmpErr = ioutil.TempDir("", "gazelle-remotecache-")
if rc.tmpErr != nil {
return
}
rc.tmpErr = ioutil.WriteFile(filepath.Join(rc.tmpDir, "go.mod"), []byte(`module gazelle_remote_cache__\n`), 0666)
})
}
var semverRex = regexp.MustCompile(`^.*?(/v\d+)(?:/.*)?$`)
// pathWithoutSemver removes a semantic version suffix from path.
// For example, if path is "example.com/foo/v2/bar", pathWithoutSemver
// will return "example.com/foo/bar". If there is no semantic version suffix,
// "" will be returned.
// TODO(jayconrod): copied from language/go. This whole type should be
// migrated there.
func pathWithoutSemver(path string) string {
m := semverRex.FindStringSubmatchIndex(path)
if m == nil {
return ""
}
v := path[m[2]+2 : m[3]]
if v == "0" || v == "1" {
return ""
}
return path[:m[2]] + path[m[3]:]
}
// findGoTool attempts to locate the go executable. If GOROOT is set, we'll
// prefer the one in there; otherwise, we'll rely on PATH. If the wrapper
// script generated by the gazelle rule is invoked by Bazel, it will set
// GOROOT to the configured SDK. We don't want to rely on the host SDK in
// that situation.
//
// TODO(jayconrod): copied from language/go (though it was originally in this
// package). Go-specific details should be removed from RemoteCache, and
// this copy should be deleted.
func findGoTool() string {
path := "go" // rely on PATH by default
if goroot, ok := os.LookupEnv("GOROOT"); ok {
path = filepath.Join(goroot, "bin", "go")
}
if runtime.GOOS == "windows" {
path += ".exe"
}
return path
}

166
vendor/github.com/bazelbuild/bazel-gazelle/repo/repo.go generated vendored Normal file
View File

@@ -0,0 +1,166 @@
/* Copyright 2017 The Bazel Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Package repo provides functionality for managing Go repository rules.
//
// UNSTABLE: The exported APIs in this package may change. In the future,
// language extensions should implement an interface for repository
// rule management. The update-repos command will call interface methods,
// and most if this package's functionality will move to language/go.
// Moving this package to an internal directory would break existing
// extensions, since RemoteCache is referenced through the resolve.Resolver
// interface, which extensions are required to implement.
package repo
import (
"fmt"
"os"
"path/filepath"
"strings"
"github.com/bazelbuild/bazel-gazelle/rule"
)
type byRuleName []*rule.Rule
func (s byRuleName) Len() int { return len(s) }
func (s byRuleName) Less(i, j int) bool { return s[i].Name() < s[j].Name() }
func (s byRuleName) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
// FindExternalRepo attempts to locate the directory where Bazel has fetched
// the external repository with the given name. An error is returned if the
// repository directory cannot be located.
func FindExternalRepo(repoRoot, name string) (string, error) {
// See https://docs.bazel.build/versions/master/output_directories.html
// for documentation on Bazel directory layout.
// We expect the bazel-out symlink in the workspace root directory to point to
// <output-base>/execroot/<workspace-name>/bazel-out
// We expect the external repository to be checked out at
// <output-base>/external/<name>
// Note that users can change the prefix for most of the Bazel symlinks with
// --symlink_prefix, but this does not include bazel-out.
externalPath := strings.Join([]string{repoRoot, "bazel-out", "..", "..", "..", "external", name}, string(os.PathSeparator))
cleanPath, err := filepath.EvalSymlinks(externalPath)
if err != nil {
return "", err
}
st, err := os.Stat(cleanPath)
if err != nil {
return "", err
}
if !st.IsDir() {
return "", fmt.Errorf("%s: not a directory", externalPath)
}
return cleanPath, nil
}
// ListRepositories extracts metadata about repositories declared in a
// file.
func ListRepositories(workspace *rule.File) (repos []*rule.Rule, repoFileMap map[string]*rule.File, err error) {
repoIndexMap := make(map[string]int)
repoFileMap = make(map[string]*rule.File)
for _, repo := range workspace.Rules {
if name := repo.Name(); name != "" {
repos = append(repos, repo)
repoFileMap[name] = workspace
repoIndexMap[name] = len(repos) - 1
}
}
extraRepos, err := parseRepositoryDirectives(workspace.Directives)
if err != nil {
return nil, nil, err
}
for _, repo := range extraRepos {
if i, ok := repoIndexMap[repo.Name()]; ok {
repos[i] = repo
} else {
repos = append(repos, repo)
}
repoFileMap[repo.Name()] = workspace
}
for _, d := range workspace.Directives {
switch d.Key {
case "repository_macro":
f, defName, err := parseRepositoryMacroDirective(d.Value)
if err != nil {
return nil, nil, err
}
f = filepath.Join(filepath.Dir(workspace.Path), filepath.Clean(f))
macroFile, err := rule.LoadMacroFile(f, "", defName)
if err != nil {
return nil, nil, err
}
for _, repo := range macroFile.Rules {
if name := repo.Name(); name != "" {
repos = append(repos, repo)
repoFileMap[name] = macroFile
repoIndexMap[name] = len(repos) - 1
}
}
extraRepos, err = parseRepositoryDirectives(macroFile.Directives)
if err != nil {
return nil, nil, err
}
for _, repo := range extraRepos {
if i, ok := repoIndexMap[repo.Name()]; ok {
repos[i] = repo
} else {
repos = append(repos, repo)
}
repoFileMap[repo.Name()] = macroFile
}
}
}
return repos, repoFileMap, nil
}
func parseRepositoryDirectives(directives []rule.Directive) (repos []*rule.Rule, err error) {
for _, d := range directives {
switch d.Key {
case "repository":
vals := strings.Fields(d.Value)
if len(vals) < 2 {
return nil, fmt.Errorf("failure parsing repository: %s, expected repository kind and attributes", d.Value)
}
kind := vals[0]
r := rule.NewRule(kind, "")
for _, val := range vals[1:] {
kv := strings.SplitN(val, "=", 2)
if len(kv) != 2 {
return nil, fmt.Errorf("failure parsing repository: %s, expected format for attributes is attr1_name=attr1_value", d.Value)
}
r.SetAttr(kv[0], kv[1])
}
if r.Name() == "" {
return nil, fmt.Errorf("failure parsing repository: %s, expected a name attribute for the given repository", d.Value)
}
repos = append(repos, r)
}
}
return repos, nil
}
func parseRepositoryMacroDirective(directive string) (string, string, error) {
vals := strings.Split(directive, "%")
if len(vals) != 2 {
return "", "", fmt.Errorf("Failure parsing repository_macro: %s, expected format is macroFile%%defName", directive)
}
f := vals[0]
if strings.HasPrefix(f, "..") {
return "", "", fmt.Errorf("Failure parsing repository_macro: %s, macro file path %s should not start with \"..\"", directive, f)
}
return f, vals[1], nil
}

View File

@@ -0,0 +1,32 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"config.go",
"index.go",
],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/resolve",
importpath = "github.com/bazelbuild/bazel-gazelle/resolve",
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/bazelbuild/bazel-gazelle/config:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/label:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/repo:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/rule:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -20,9 +20,9 @@ import (
"log"
"strings"
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/label"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/label"
"github.com/bazelbuild/bazel-gazelle/rule"
)
// FindRuleWithOverride searches the current configuration for user-specified

View File

@@ -18,10 +18,10 @@ package resolve
import (
"log"
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/label"
"github.com/bazelbuild/bazel-gazelle/internal/repos"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/label"
"github.com/bazelbuild/bazel-gazelle/repo"
"github.com/bazelbuild/bazel-gazelle/rule"
)
// ImportSpec describes a library to be imported. Imp is an import string for
@@ -53,27 +53,28 @@ type Resolver interface {
Embeds(r *rule.Rule, from label.Label) []label.Label
// Resolve translates imported libraries for a given rule into Bazel
// dependencies. A list of imported libraries is typically stored in a
// private attribute of the rule when it's generated (this interface doesn't
// dictate how that is stored or represented). Resolve generates a "deps"
// attribute (or the appropriate language-specific equivalent) for each
// import according to language-specific rules and heuristics.
Resolve(c *config.Config, ix *RuleIndex, rc *repos.RemoteCache, r *rule.Rule, from label.Label)
// dependencies. Information about imported libraries is returned for each
// rule generated by language.GenerateRules in
// language.GenerateResult.Imports. Resolve generates a "deps" attribute (or
// the appropriate language-specific equivalent) for each import according to
// language-specific rules and heuristics.
Resolve(c *config.Config, ix *RuleIndex, rc *repo.RemoteCache, r *rule.Rule, imports interface{}, from label.Label)
}
// RuleIndex is a table of rules in a workspace, indexed by label and by
// import path. Used by Resolver to map import paths to labels.
type RuleIndex struct {
rules []*ruleRecord
labelMap map[label.Label]*ruleRecord
importMap map[ImportSpec][]*ruleRecord
kindToResolver map[string]Resolver
rules []*ruleRecord
labelMap map[label.Label]*ruleRecord
importMap map[ImportSpec][]*ruleRecord
mrslv func(r *rule.Rule, pkgRel string) Resolver
}
// ruleRecord contains information about a rule relevant to import indexing.
type ruleRecord struct {
rule *rule.Rule
label label.Label
file *rule.File
// importedAs is a list of ImportSpecs by which this rule may be imported.
// Used to build a map from ImportSpecs to ruleRecords.
@@ -96,10 +97,10 @@ type ruleRecord struct {
//
// kindToResolver is a map from rule kinds (for example, "go_library") to
// Resolvers that support those kinds.
func NewRuleIndex(kindToResolver map[string]Resolver) *RuleIndex {
func NewRuleIndex(mrslv func(r *rule.Rule, pkgRel string) Resolver) *RuleIndex {
return &RuleIndex{
labelMap: make(map[label.Label]*ruleRecord),
kindToResolver: kindToResolver,
labelMap: make(map[label.Label]*ruleRecord),
mrslv: mrslv,
}
}
@@ -110,7 +111,7 @@ func NewRuleIndex(kindToResolver map[string]Resolver) *RuleIndex {
// AddRule may only be called before Finish.
func (ix *RuleIndex) AddRule(c *config.Config, r *rule.Rule, f *rule.File) {
var imps []ImportSpec
if rslv, ok := ix.kindToResolver[r.Kind()]; ok {
if rslv := ix.mrslv(r, f.Pkg); rslv != nil {
imps = rslv.Imports(c, r, f)
}
// If imps == nil, the rule is not importable. If imps is the empty slice,
@@ -122,6 +123,7 @@ func (ix *RuleIndex) AddRule(c *config.Config, r *rule.Rule, f *rule.File) {
record := &ruleRecord{
rule: r,
label: label.New(c.RepoName, f.Pkg, r.Name()),
file: f,
importedAs: imps,
}
if _, ok := ix.labelMap[record.label]; ok {
@@ -149,8 +151,9 @@ func (ix *RuleIndex) collectEmbeds(r *ruleRecord) {
if r.didCollectEmbeds {
return
}
resolver := ix.mrslv(r.rule, r.file.Pkg)
r.didCollectEmbeds = true
embedLabels := ix.kindToResolver[r.rule.Kind()].Embeds(r.rule, r.label)
embedLabels := resolver.Embeds(r.rule, r.label)
r.embeds = embedLabels
for _, e := range embedLabels {
er, ok := ix.findRuleByLabel(e, r.label)
@@ -158,7 +161,7 @@ func (ix *RuleIndex) collectEmbeds(r *ruleRecord) {
continue
}
ix.collectEmbeds(er)
if ix.kindToResolver[r.rule.Kind()] == ix.kindToResolver[er.rule.Kind()] {
if resolver == ix.mrslv(er.rule, er.file.Pkg) {
er.embedded = true
r.embeds = append(r.embeds, er.embeds...)
}
@@ -215,7 +218,7 @@ func (ix *RuleIndex) FindRulesByImport(imp ImportSpec, lang string) []FindResult
matches := ix.importMap[imp]
results := make([]FindResult, 0, len(matches))
for _, m := range matches {
if ix.kindToResolver[m.rule.Kind()].Name() != lang {
if ix.mrslv(m.rule, "").Name() != lang {
continue
}
results = append(results, FindResult{

View File

@@ -13,11 +13,11 @@ go_library(
"types.go",
"value.go",
],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/internal/rule",
importpath = "github.com/bazelbuild/bazel-gazelle/internal/rule",
visibility = ["//vendor/github.com/bazelbuild/bazel-gazelle:__subpackages__"],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/rule",
importpath = "github.com/bazelbuild/bazel-gazelle/rule",
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/label:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/label:go_default_library",
"//vendor/github.com/bazelbuild/buildtools/build:go_default_library",
"//vendor/github.com/bazelbuild/buildtools/tables:go_default_library",
],

View File

@@ -39,6 +39,17 @@ type Directive struct {
// is returned. Errors are reported for unrecognized directives and directives
// out of place (after the first statement).
func ParseDirectives(f *bzl.File) []Directive {
return parseDirectives(f.Stmt)
}
// ParseDirectivesFromMacro scans a macro body for Gazelle directives. The
// full list of directives is returned. Errors are reported for unrecognized
// directives and directives out of place (after the first statement).
func ParseDirectivesFromMacro(f *bzl.DefStmt) []Directive {
return parseDirectives(f.Body)
}
func parseDirectives(stmt []bzl.Expr) []Directive {
var directives []Directive
parseComment := func(com bzl.Comment) {
match := directiveRe.FindStringSubmatch(com.Token)
@@ -49,7 +60,7 @@ func ParseDirectives(f *bzl.File) []Directive {
directives = append(directives, Directive{key, value})
}
for _, s := range f.Stmt {
for _, s := range stmt {
coms := s.Comment()
for _, com := range coms.Before {
parseComment(com)

View File

@@ -20,7 +20,7 @@ import (
"log"
"strings"
"github.com/bazelbuild/bazel-gazelle/internal/label"
"github.com/bazelbuild/bazel-gazelle/label"
bzl "github.com/bazelbuild/buildtools/build"
)
@@ -80,7 +80,7 @@ func MapExprStrings(e bzl.Expr, f func(string) string) bzl.Expr {
return &ret
case *bzl.CallExpr:
if x, ok := expr.X.(*bzl.LiteralExpr); !ok || x.Token != "select" || len(expr.List) != 1 {
if x, ok := expr.X.(*bzl.Ident); !ok || x.Name != "select" || len(expr.List) != 1 {
log.Panicf("unexpected call expression in generated imports: %#v", e)
}
arg := MapExprStrings(expr.List[0], f)
@@ -170,7 +170,7 @@ func FlattenExpr(e bzl.Expr) bzl.Expr {
func isScalar(e bzl.Expr) bool {
switch e.(type) {
case *bzl.StringExpr, *bzl.LiteralExpr:
case *bzl.StringExpr, *bzl.LiteralExpr, *bzl.Ident:
return true
default:
return false
@@ -250,8 +250,8 @@ func extractPlatformStringsExprs(expr bzl.Expr) (platformStringsExprs, error) {
ps.generic = part
case *bzl.CallExpr:
x, ok := part.X.(*bzl.LiteralExpr)
if !ok || x.Token != "select" || len(part.List) != 1 {
x, ok := part.X.(*bzl.Ident)
if !ok || x.Name != "select" || len(part.List) != 1 {
return platformStringsExprs{}, fmt.Errorf("expression could not be matched: callee other than select or wrong number of args")
}
arg, ok := part.List[0].(*bzl.DictExpr)
@@ -307,7 +307,7 @@ func extractPlatformStringsExprs(expr bzl.Expr) (platformStringsExprs, error) {
func makePlatformStringsExpr(ps platformStringsExprs) bzl.Expr {
makeSelect := func(dict *bzl.DictExpr) bzl.Expr {
return &bzl.CallExpr{
X: &bzl.LiteralExpr{Token: "select"},
X: &bzl.Ident{Name: "select"},
List: []bzl.Expr{dict},
}
}

View File

@@ -51,7 +51,7 @@ func MergeRules(src, dst *Rule, mergeable map[string]bool, filename string) {
if _, ok := src.attrs[key]; ok || !mergeable[key] || ShouldKeep(dstAttr) {
continue
}
dstValue := dstAttr.Y
dstValue := dstAttr.RHS
if mergedValue, err := mergeExprs(nil, dstValue); err != nil {
start, end := dstValue.Span()
log.Printf("%s:%d.%d-%d.%d: could not merge expression", filename, start.Line, start.LineRune, end.Line, end.LineRune)
@@ -64,11 +64,11 @@ func MergeRules(src, dst *Rule, mergeable map[string]bool, filename string) {
// Merge attributes from src into dst.
for key, srcAttr := range src.attrs {
srcValue := srcAttr.Y
srcValue := srcAttr.RHS
if dstAttr, ok := dst.attrs[key]; !ok {
dst.SetAttr(key, srcValue)
} else if mergeable[key] && !ShouldKeep(dstAttr) {
dstValue := dstAttr.Y
dstValue := dstAttr.RHS
if mergedValue, err := mergeExprs(srcValue, dstValue); err != nil {
start, end := dstValue.Span()
log.Printf("%s:%d.%d-%d.%d: could not merge expression", filename, start.Line, start.LineRune, end.Line, end.LineRune)
@@ -275,11 +275,11 @@ func SquashRules(src, dst *Rule, filename string) error {
}
for key, srcAttr := range src.attrs {
srcValue := srcAttr.Y
srcValue := srcAttr.RHS
if dstAttr, ok := dst.attrs[key]; !ok {
dst.SetAttr(key, srcValue)
} else if !ShouldKeep(dstAttr) {
dstValue := dstAttr.Y
dstValue := dstAttr.RHS
if squashedValue, err := squashExprs(srcValue, dstValue); err != nil {
start, end := dstValue.Span()
return fmt.Errorf("%s:%d.%d-%d.%d: could not squash expression", filename, start.Line, start.LineRune, end.Line, end.LineRune)
@@ -288,9 +288,9 @@ func SquashRules(src, dst *Rule, filename string) error {
}
}
}
dst.call.Comments.Before = append(dst.call.Comments.Before, src.call.Comments.Before...)
dst.call.Comments.Suffix = append(dst.call.Comments.Suffix, src.call.Comments.Suffix...)
dst.call.Comments.After = append(dst.call.Comments.After, src.call.Comments.After...)
dst.expr.Comment().Before = append(dst.expr.Comment().Before, src.expr.Comment().Before...)
dst.expr.Comment().Suffix = append(dst.expr.Comment().Suffix, src.expr.Comment().Suffix...)
dst.expr.Comment().After = append(dst.expr.Comment().After, src.expr.Comment().After...)
return nil
}

View File

@@ -21,6 +21,9 @@ import (
// Platform represents a GOOS/GOARCH pair. When Platform is used to describe
// sources, dependencies, or flags, either OS or Arch may be empty.
//
// DEPRECATED: do not use outside language/go. This type is Go-specific
// and should be moved to the Go extension.
type Platform struct {
OS, Arch string
}
@@ -43,6 +46,8 @@ func (p Platform) String() string {
// KnownPlatforms is the set of target platforms that Go supports. Gazelle
// will generate multi-platform build files using these tags. rules_go and
// Bazel may not actually support all of these.
//
// DEPRECATED: do not use outside language/go.
var KnownPlatforms = []Platform{
{"android", "386"},
{"android", "amd64"},
@@ -56,6 +61,10 @@ var KnownPlatforms = []Platform{
{"freebsd", "386"},
{"freebsd", "amd64"},
{"freebsd", "arm"},
{"ios", "386"},
{"ios", "amd64"},
{"ios", "arm"},
{"ios", "arm64"},
{"linux", "386"},
{"linux", "amd64"},
{"linux", "arm"},
@@ -84,6 +93,11 @@ var KnownPlatforms = []Platform{
{"windows", "amd64"},
}
var OSAliases = map[string][]string{
"android": []string{"linux"},
"ios": []string{"darwin"},
}
var (
// KnownOSs is the sorted list of operating systems that Go supports.
KnownOSs []string

View File

@@ -18,6 +18,8 @@ package rule
import (
"sort"
"strings"
bzl "github.com/bazelbuild/buildtools/build"
)
// PlatformStrings contains a set of strings associated with a buildable
@@ -30,6 +32,9 @@ import (
// in more than one list within a set (e.g., in "linux" and "windows" within
// the OS set). Strings within each list should be sorted, though this may
// not be relied upon.
//
// DEPRECATED: do not use outside language/go. This type is Go-specific and
// should be moved to the Go extension.
type PlatformStrings struct {
// Generic is a list of strings not specific to any platform.
Generic []string
@@ -190,3 +195,51 @@ func (ps *PlatformStrings) MapSlice(f func([]string) ([]string, error)) (Platfor
}
return result, errors
}
func (ps PlatformStrings) BzlExpr() bzl.Expr {
var pieces []bzl.Expr
if len(ps.Generic) > 0 {
pieces = append(pieces, ExprFromValue(ps.Generic))
}
if len(ps.OS) > 0 {
pieces = append(pieces, platformStringsOSArchDictExpr(ps.OS))
}
if len(ps.Arch) > 0 {
pieces = append(pieces, platformStringsOSArchDictExpr(ps.Arch))
}
if len(ps.Platform) > 0 {
pieces = append(pieces, platformStringsPlatformDictExpr(ps.Platform))
}
if len(pieces) == 0 {
return &bzl.ListExpr{}
} else if len(pieces) == 1 {
return pieces[0]
} else {
e := pieces[0]
if list, ok := e.(*bzl.ListExpr); ok {
list.ForceMultiLine = true
}
for _, piece := range pieces[1:] {
e = &bzl.BinaryExpr{X: e, Y: piece, Op: "+"}
}
return e
}
}
func platformStringsOSArchDictExpr(m map[string][]string) bzl.Expr {
s := make(SelectStringListValue)
for key, value := range m {
s["@io_bazel_rules_go//go/platform:"+key] = value
}
s["//conditions:default"] = nil
return s.BzlExpr()
}
func platformStringsPlatformDictExpr(m map[Platform][]string) bzl.Expr {
s := make(SelectStringListValue)
for key, value := range m {
s["@io_bazel_rules_go//go/platform:"+key.String()] = value
}
s["//conditions:default"] = nil
return s.BzlExpr()
}

View File

@@ -19,13 +19,14 @@ limitations under the License.
// is language agnostic, but it may be used for language-specific rules by
// providing configuration.
//
// File is the primary interface to this package. Rule and Load are used to
// create, read, update, and delete rules. Once modifications are performed,
// File.Sync() may be called to write the changes back to the original AST,
// which may then be formatted and written back to a file.
// File is the primary interface to this package. A File represents an
// individual build file. It comprises a list of Rules and a list of Loads.
// Rules and Loads may be inserted, modified, or deleted. When all changes
// are done, File.Save() may be called to write changes back to a file.
package rule
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
@@ -36,22 +37,29 @@ import (
bt "github.com/bazelbuild/buildtools/tables"
)
// File provides editing functionality on top of a Skylark syntax tree. This
// is the primary interface Gazelle uses for reading and updating build files.
// To use, create a new file with EmptyFile or wrap a syntax tree with
// LoadFile. Perform edits on Loads and Rules, then call Sync() to write
// changes back to the AST.
// File provides editing functionality for a build file. You can create a
// new file with EmptyFile or load an existing file with LoadFile. After
// changes have been made, call Save to write changes back to a file.
type File struct {
// File is the underlying build file syntax tree. Some editing operations
// may modify this, but editing is not complete until Sync() is called.
File *bzl.File
// function is the underlying syntax tree of a bzl file function.
// This is used for editing the bzl file function specified by the
// update-repos -to_macro option.
function *function
// Pkg is the Bazel package this build file defines.
Pkg string
// Path is the file system path to the build file (same as File.Path).
Path string
// DefName is the name of the function definition this File refers to
// if loaded with LoadMacroFile or a similar function. Normally empty.
DefName string
// Directives is a list of configuration directives found in top-level
// comments in the file. This should not be modified after the file is read.
Directives []Directive
@@ -68,7 +76,7 @@ type File struct {
// EmptyFile creates a File wrapped around an empty syntax tree.
func EmptyFile(path, pkg string) *File {
return &File{
File: &bzl.File{Path: path},
File: &bzl.File{Path: path, Type: bzl.TypeBuild},
Path: path,
Pkg: pkg,
}
@@ -88,48 +96,142 @@ func LoadFile(path, pkg string) (*File, error) {
return LoadData(path, pkg, data)
}
// LoadWorkspaceFile is similar to LoadFile but parses the file as a WORKSPACE
// file.
func LoadWorkspaceFile(path, pkg string) (*File, error) {
data, err := ioutil.ReadFile(path)
if err != nil {
return nil, err
}
return LoadWorkspaceData(path, pkg, data)
}
// LoadMacroFile loads a bzl file from disk, parses it, then scans for the load
// statements and the rules called from the given Starlark function. If there is
// no matching function name, then a new function with that name will be created.
// The function's syntax tree will be returned within File and can be modified by
// Sync and Save calls.
func LoadMacroFile(path, pkg, defName string) (*File, error) {
data, err := ioutil.ReadFile(path)
if err != nil {
return nil, err
}
return LoadMacroData(path, pkg, defName, data)
}
// EmptyMacroFile creates a bzl file at the given path and within the file creates
// a Starlark function with the provided name. The function can then be modified
// by Sync and Save calls.
func EmptyMacroFile(path, pkg, defName string) (*File, error) {
_, err := os.Create(path)
if err != nil {
return nil, err
}
return LoadMacroData(path, pkg, defName, nil)
}
// LoadData parses a build file from a byte slice and scans it for rules and
// load statements. The syntax tree within the returned File will be modified
// by editing methods.
func LoadData(path, pkg string, data []byte) (*File, error) {
ast, err := bzl.Parse(path, data)
ast, err := bzl.ParseBuild(path, data)
if err != nil {
return nil, err
}
return ScanAST(pkg, ast), nil
}
// LoadWorkspaceData is similar to LoadData but parses the data as a
// WORKSPACE file.
func LoadWorkspaceData(path, pkg string, data []byte) (*File, error) {
ast, err := bzl.ParseWorkspace(path, data)
if err != nil {
return nil, err
}
return ScanAST(pkg, ast), nil
}
// LoadMacroData parses a bzl file from a byte slice and scans for the load
// statements and the rules called from the given Starlark function. If there is
// no matching function name, then a new function will be created, and added to the
// File the next time Sync is called. The function's syntax tree will be returned
// within File and can be modified by Sync and Save calls.
func LoadMacroData(path, pkg, defName string, data []byte) (*File, error) {
ast, err := bzl.ParseBzl(path, data)
if err != nil {
return nil, err
}
return ScanASTBody(pkg, defName, ast), nil
}
// ScanAST creates a File wrapped around the given syntax tree. This tree
// will be modified by editing methods.
func ScanAST(pkg string, bzlFile *bzl.File) *File {
return ScanASTBody(pkg, "", bzlFile)
}
type function struct {
stmt *bzl.DefStmt
inserted, hasPass bool
}
// ScanASTBody creates a File wrapped around the given syntax tree. It will also
// scan the AST for a function matching the given defName, and if the function
// does not exist it will create a new one and mark it to be added to the File
// the next time Sync is called.
func ScanASTBody(pkg, defName string, bzlFile *bzl.File) *File {
f := &File{
File: bzlFile,
Pkg: pkg,
Path: bzlFile.Path,
File: bzlFile,
Pkg: pkg,
Path: bzlFile.Path,
DefName: defName,
}
for i, stmt := range f.File.Stmt {
call, ok := stmt.(*bzl.CallExpr)
if !ok {
continue
var defStmt *bzl.DefStmt
f.Rules, f.Loads, defStmt = scanExprs(defName, bzlFile.Stmt)
if defStmt != nil {
f.Rules, _, _ = scanExprs("", defStmt.Body)
f.function = &function{
stmt: defStmt,
inserted: true,
}
x, ok := call.X.(*bzl.LiteralExpr)
if !ok {
continue
}
if x.Token == "load" {
if l := loadFromExpr(i, call); l != nil {
f.Loads = append(f.Loads, l)
}
} else {
if r := ruleFromExpr(i, call); r != nil {
f.Rules = append(f.Rules, r)
if len(defStmt.Body) == 1 {
if v, ok := defStmt.Body[0].(*bzl.BranchStmt); ok && v.Token == "pass" {
f.function.hasPass = true
}
}
} else if defName != "" {
f.function = &function{
stmt: &bzl.DefStmt{Name: defName},
inserted: false,
}
}
if f.function != nil {
f.Directives = ParseDirectivesFromMacro(f.function.stmt)
} else {
f.Directives = ParseDirectives(bzlFile)
}
f.Directives = ParseDirectives(bzlFile)
return f
}
func scanExprs(defName string, stmt []bzl.Expr) (rules []*Rule, loads []*Load, fn *bzl.DefStmt) {
for i, expr := range stmt {
switch expr := expr.(type) {
case *bzl.LoadStmt:
l := loadFromExpr(i, expr)
loads = append(loads, l)
case *bzl.CallExpr:
if r := ruleFromExpr(i, expr); r != nil {
rules = append(rules, r)
}
case *bzl.DefStmt:
if expr.Name == defName {
fn = expr
}
}
}
return rules, loads, fn
}
// MatchBuildFileName looks for a file in files that has a name from names.
// If there is at least one matching file, a path will be returned by joining
// dir and the first matching name. If there are no matching files, the
@@ -145,73 +247,119 @@ func MatchBuildFileName(dir string, names []string, files []os.FileInfo) string
return ""
}
// SyncMacroFile syncs the file's syntax tree with another file's. This is
// useful for keeping multiple macro definitions from the same .bzl file in sync.
func (f *File) SyncMacroFile(from *File) {
fromFunc := *from.function.stmt
_, _, toFunc := scanExprs(from.function.stmt.Name, f.File.Stmt)
if toFunc != nil {
*toFunc = fromFunc
} else {
f.File.Stmt = append(f.File.Stmt, &fromFunc)
}
}
// MacroName returns the name of the macro function that this file is editing,
// or an empty string if a macro function is not being edited.
func (f *File) MacroName() string {
if f.function != nil && f.function.stmt != nil {
return f.function.stmt.Name
}
return ""
}
// Sync writes all changes back to the wrapped syntax tree. This should be
// called after editing operations, before reading the syntax tree again.
func (f *File) Sync() {
var inserts, deletes, stmts []*stmt
var loadInserts, loadDeletes, loadStmts []*stmt
var r, w int
for r, w = 0, 0; r < len(f.Loads); r++ {
s := f.Loads[r]
s.sync()
if s.deleted {
deletes = append(deletes, &s.stmt)
loadDeletes = append(loadDeletes, &s.stmt)
continue
}
if s.inserted {
inserts = append(inserts, &s.stmt)
loadInserts = append(loadInserts, &s.stmt)
s.inserted = false
} else {
stmts = append(stmts, &s.stmt)
loadStmts = append(loadStmts, &s.stmt)
}
f.Loads[w] = s
w++
}
f.Loads = f.Loads[:w]
var ruleInserts, ruleDeletes, ruleStmts []*stmt
for r, w = 0, 0; r < len(f.Rules); r++ {
s := f.Rules[r]
s.sync()
if s.deleted {
deletes = append(deletes, &s.stmt)
ruleDeletes = append(ruleDeletes, &s.stmt)
continue
}
if s.inserted {
inserts = append(inserts, &s.stmt)
ruleInserts = append(ruleInserts, &s.stmt)
s.inserted = false
} else {
stmts = append(stmts, &s.stmt)
ruleStmts = append(ruleStmts, &s.stmt)
}
f.Rules[w] = s
w++
}
f.Rules = f.Rules[:w]
if f.function == nil {
deletes := append(ruleDeletes, loadDeletes...)
inserts := append(ruleInserts, loadInserts...)
stmts := append(ruleStmts, loadStmts...)
updateStmt(&f.File.Stmt, inserts, deletes, stmts)
} else {
updateStmt(&f.File.Stmt, loadInserts, loadDeletes, loadStmts)
if f.function.hasPass && len(ruleInserts) > 0 {
f.function.stmt.Body = []bzl.Expr{}
f.function.hasPass = false
}
updateStmt(&f.function.stmt.Body, ruleInserts, ruleDeletes, ruleStmts)
if len(f.function.stmt.Body) == 0 {
f.function.stmt.Body = append(f.function.stmt.Body, &bzl.BranchStmt{Token: "pass"})
f.function.hasPass = true
}
if !f.function.inserted {
f.File.Stmt = append(f.File.Stmt, f.function.stmt)
f.function.inserted = true
}
}
}
func updateStmt(oldStmt *[]bzl.Expr, inserts, deletes, stmts []*stmt) {
sort.Stable(byIndex(deletes))
sort.Stable(byIndex(inserts))
sort.Stable(byIndex(stmts))
oldStmt := f.File.Stmt
f.File.Stmt = make([]bzl.Expr, 0, len(oldStmt)-len(deletes)+len(inserts))
newStmt := make([]bzl.Expr, 0, len(*oldStmt)-len(deletes)+len(inserts))
var ii, di, si int
for i, stmt := range oldStmt {
for i, stmt := range *oldStmt {
for ii < len(inserts) && inserts[ii].index == i {
inserts[ii].index = len(f.File.Stmt)
f.File.Stmt = append(f.File.Stmt, inserts[ii].call)
inserts[ii].index = len(newStmt)
newStmt = append(newStmt, inserts[ii].expr)
ii++
}
if di < len(deletes) && deletes[di].index == i {
di++
continue
}
if si < len(stmts) && stmts[si].call == stmt {
stmts[si].index = len(f.File.Stmt)
if si < len(stmts) && stmts[si].expr == stmt {
stmts[si].index = len(newStmt)
si++
}
f.File.Stmt = append(f.File.Stmt, stmt)
newStmt = append(newStmt, stmt)
}
for ii < len(inserts) {
inserts[ii].index = len(f.File.Stmt)
f.File.Stmt = append(f.File.Stmt, inserts[ii].call)
inserts[ii].index = len(newStmt)
newStmt = append(newStmt, inserts[ii].expr)
ii++
}
*oldStmt = newStmt
}
// Format formats the build file in a form that can be written to disk.
@@ -228,10 +376,22 @@ func (f *File) Save(path string) error {
return ioutil.WriteFile(path, data, 0666)
}
// HasDefaultVisibility returns whether the File contains a "package" rule with
// a "default_visibility" attribute. Rules generated by Gazelle should not
// have their own visibility attributes if this is the case.
func (f *File) HasDefaultVisibility() bool {
for _, r := range f.Rules {
if r.Kind() == "package" && r.Attr("default_visibility") != nil {
return true
}
}
return false
}
type stmt struct {
index int
deleted, inserted, updated bool
call *bzl.CallExpr
expr bzl.Expr
}
// Index returns the index for this statement within the build file. For
@@ -258,57 +418,42 @@ func (s byIndex) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
// identPair represents one symbol, with or without remapping, in a load
// statement within a build file.
type identPair struct {
to, from *bzl.Ident
}
// Load represents a load statement within a build file.
type Load struct {
stmt
name string
symbols map[string]bzl.Expr
symbols map[string]identPair
}
// NewLoad creates a new, empty load statement for the given file name.
func NewLoad(name string) *Load {
return &Load{
stmt: stmt{
call: &bzl.CallExpr{
X: &bzl.LiteralExpr{Token: "load"},
List: []bzl.Expr{&bzl.StringExpr{Value: name}},
expr: &bzl.LoadStmt{
Module: &bzl.StringExpr{Value: name},
ForceCompact: true,
},
},
name: name,
symbols: make(map[string]bzl.Expr),
symbols: make(map[string]identPair),
}
}
func loadFromExpr(index int, call *bzl.CallExpr) *Load {
func loadFromExpr(index int, loadStmt *bzl.LoadStmt) *Load {
l := &Load{
stmt: stmt{index: index, call: call},
symbols: make(map[string]bzl.Expr),
stmt: stmt{index: index, expr: loadStmt},
name: loadStmt.Module.Value,
symbols: make(map[string]identPair),
}
if len(call.List) == 0 {
return nil
}
name, ok := call.List[0].(*bzl.StringExpr)
if !ok {
return nil
}
l.name = name.Value
for _, arg := range call.List[1:] {
switch arg := arg.(type) {
case *bzl.StringExpr:
l.symbols[arg.Value] = arg
case *bzl.BinaryExpr:
x, ok := arg.X.(*bzl.LiteralExpr)
if !ok {
return nil
}
if _, ok := arg.Y.(*bzl.StringExpr); !ok {
return nil
}
l.symbols[x.Token] = arg
default:
return nil
}
for i := range loadStmt.From {
to, from := loadStmt.To[i], loadStmt.From[i]
l.symbols[to.Name] = identPair{to: to, from: from}
}
return l
}
@@ -339,7 +484,8 @@ func (l *Load) Has(sym string) bool {
// doesn't matter.
func (l *Load) Add(sym string) {
if _, ok := l.symbols[sym]; !ok {
l.symbols[sym] = &bzl.StringExpr{Value: sym}
i := &bzl.Ident{Name: sym}
l.symbols[sym] = identPair{to: i, from: i}
l.updated = true
}
}
@@ -373,32 +519,32 @@ func (l *Load) sync() {
}
l.updated = false
args := make([]*bzl.StringExpr, 0, len(l.symbols))
kwargs := make([]*bzl.BinaryExpr, 0, len(l.symbols))
for _, e := range l.symbols {
if a, ok := e.(*bzl.StringExpr); ok {
args = append(args, a)
// args1 and args2 are two different sort groups based on whether a remap of the identifier is present.
var args1, args2, args []string
for sym, pair := range l.symbols {
if pair.from.Name == pair.to.Name {
args1 = append(args1, sym)
} else {
kwargs = append(kwargs, e.(*bzl.BinaryExpr))
args2 = append(args2, sym)
}
}
sort.Slice(args, func(i, j int) bool {
return args[i].Value < args[j].Value
})
sort.Slice(kwargs, func(i, j int) bool {
return kwargs[i].X.(*bzl.StringExpr).Value < kwargs[j].Y.(*bzl.StringExpr).Value
})
sort.Strings(args1)
sort.Strings(args2)
args = append(args, args1...)
args = append(args, args2...)
list := make([]bzl.Expr, 0, 1+len(l.symbols))
list = append(list, l.call.List[0])
for _, a := range args {
list = append(list, a)
loadStmt := l.expr.(*bzl.LoadStmt)
loadStmt.Module.Value = l.name
loadStmt.From = make([]*bzl.Ident, 0, len(args))
loadStmt.To = make([]*bzl.Ident, 0, len(args))
for _, sym := range args {
pair := l.symbols[sym]
loadStmt.From = append(loadStmt.From, pair.from)
loadStmt.To = append(loadStmt.To, pair.to)
if pair.from.Name != pair.to.Name {
loadStmt.ForceCompact = false
}
}
for _, a := range kwargs {
list = append(list, a)
}
l.call.List = list
l.call.ForceCompact = len(kwargs) == 0
}
// Rule represents a rule statement within a build file.
@@ -406,26 +552,26 @@ type Rule struct {
stmt
kind string
args []bzl.Expr
attrs map[string]*bzl.BinaryExpr
attrs map[string]*bzl.AssignExpr
private map[string]interface{}
}
// NewRule creates a new, empty rule with the given kind and name.
func NewRule(kind, name string) *Rule {
nameAttr := &bzl.BinaryExpr{
X: &bzl.LiteralExpr{Token: "name"},
Y: &bzl.StringExpr{Value: name},
Op: "=",
nameAttr := &bzl.AssignExpr{
LHS: &bzl.Ident{Name: "name"},
RHS: &bzl.StringExpr{Value: name},
Op: "=",
}
r := &Rule{
stmt: stmt{
call: &bzl.CallExpr{
X: &bzl.LiteralExpr{Token: kind},
expr: &bzl.CallExpr{
X: &bzl.Ident{Name: kind},
List: []bzl.Expr{nameAttr},
},
},
kind: kind,
attrs: map[string]*bzl.BinaryExpr{"name": nameAttr},
attrs: map[string]*bzl.AssignExpr{"name": nameAttr},
private: map[string]interface{}{},
}
return r
@@ -436,18 +582,17 @@ func ruleFromExpr(index int, expr bzl.Expr) *Rule {
if !ok {
return nil
}
x, ok := call.X.(*bzl.LiteralExpr)
x, ok := call.X.(*bzl.Ident)
if !ok {
return nil
}
kind := x.Token
kind := x.Name
var args []bzl.Expr
attrs := make(map[string]*bzl.BinaryExpr)
attrs := make(map[string]*bzl.AssignExpr)
for _, arg := range call.List {
attr, ok := arg.(*bzl.BinaryExpr)
if ok && attr.Op == "=" {
key := attr.X.(*bzl.LiteralExpr) // required by parser
attrs[key.Token] = attr
if attr, ok := arg.(*bzl.AssignExpr); ok {
key := attr.LHS.(*bzl.Ident) // required by parser
attrs[key.Name] = attr
} else {
args = append(args, arg)
}
@@ -455,7 +600,7 @@ func ruleFromExpr(index int, expr bzl.Expr) *Rule {
return &Rule{
stmt: stmt{
index: index,
call: call,
expr: call,
},
kind: kind,
args: args,
@@ -468,22 +613,27 @@ func ruleFromExpr(index int, expr bzl.Expr) *Rule {
// that are kept should not be modified. This does not check whether
// subexpressions within the rule should be kept.
func (r *Rule) ShouldKeep() bool {
return ShouldKeep(r.call)
return ShouldKeep(r.expr)
}
// Kind returns the kind of rule this is (for example, "go_library").
func (r *Rule) Kind() string {
return r.kind
}
// SetKind changes the kind of rule this is.
func (r *Rule) SetKind(kind string) {
r.kind = kind
r.updated = true
}
// Name returns the value of the rule's "name" attribute if it is a string
// or "" if the attribute does not exist or is not a string.
func (r *Rule) Name() string {
return r.AttrString("name")
}
// SetName sets the value of the rule's "name" attribute.
func (r *Rule) SetName(name string) {
r.SetAttr("name", name)
}
@@ -510,7 +660,7 @@ func (r *Rule) Attr(key string) bzl.Expr {
if !ok {
return nil
}
return attr.Y
return attr.RHS
}
// AttrString returns the value of the named attribute if it is a scalar string.
@@ -520,7 +670,7 @@ func (r *Rule) AttrString(key string) string {
if !ok {
return ""
}
str, ok := attr.Y.(*bzl.StringExpr)
str, ok := attr.RHS.(*bzl.StringExpr)
if !ok {
return ""
}
@@ -535,7 +685,7 @@ func (r *Rule) AttrStrings(key string) []string {
if !ok {
return nil
}
list, ok := attr.Y.(*bzl.ListExpr)
list, ok := attr.RHS.(*bzl.ListExpr)
if !ok {
return nil
}
@@ -557,14 +707,14 @@ func (r *Rule) DelAttr(key string) {
// SetAttr adds or replaces the named attribute with an expression produced
// by ExprFromValue.
func (r *Rule) SetAttr(key string, value interface{}) {
y := ExprFromValue(value)
rhs := ExprFromValue(value)
if attr, ok := r.attrs[key]; ok {
attr.Y = y
attr.RHS = rhs
} else {
r.attrs[key] = &bzl.BinaryExpr{
X: &bzl.LiteralExpr{Token: key},
Y: y,
Op: "=",
r.attrs[key] = &bzl.AssignExpr{
LHS: &bzl.Ident{Name: key},
RHS: rhs,
Op: "=",
}
}
r.updated = true
@@ -602,7 +752,13 @@ func (r *Rule) Args() []bzl.Expr {
func (r *Rule) Insert(f *File) {
// TODO(jayconrod): should rules always be inserted at the end? Should there
// be some sort order?
r.index = len(f.File.Stmt)
var stmt []bzl.Expr
if f.function == nil {
stmt = f.File.Stmt
} else {
stmt = f.function.stmt.Body
}
r.index = len(stmt)
r.inserted = true
f.Rules = append(f.Rules, r)
}
@@ -622,18 +778,6 @@ func (r *Rule) IsEmpty(info KindInfo) bool {
return true
}
func (r *Rule) IsEmptyOld(attrs map[string]bool) bool {
if attrs == nil {
return false
}
for k := range attrs {
if _, ok := r.attrs[k]; ok {
return false
}
}
return true
}
func (r *Rule) sync() {
if !r.updated {
return
@@ -642,12 +786,15 @@ func (r *Rule) sync() {
for _, k := range []string{"srcs", "deps"} {
if attr, ok := r.attrs[k]; ok {
bzl.Walk(attr.Y, sortExprLabels)
bzl.Walk(attr.RHS, sortExprLabels)
}
}
call := r.call
call.X.(*bzl.LiteralExpr).Token = r.kind
call := r.expr.(*bzl.CallExpr)
call.X.(*bzl.Ident).Name = r.kind
if len(r.attrs) > 1 {
call.ForceMultiLine = true
}
list := make([]bzl.Expr, 0, len(r.args)+len(r.attrs))
list = append(list, r.args...)
@@ -655,7 +802,7 @@ func (r *Rule) sync() {
list = append(list, attr)
}
sortedAttrs := list[len(r.args):]
key := func(e bzl.Expr) string { return e.(*bzl.BinaryExpr).X.(*bzl.LiteralExpr).Token }
key := func(e bzl.Expr) string { return e.(*bzl.AssignExpr).LHS.(*bzl.Ident).Name }
sort.SliceStable(sortedAttrs, func(i, j int) bool {
ki := key(sortedAttrs[i])
kj := key(sortedAttrs[j])
@@ -665,7 +812,7 @@ func (r *Rule) sync() {
return ki < kj
})
r.call.List = list
call.List = list
r.updated = false
}
@@ -681,6 +828,17 @@ func ShouldKeep(e bzl.Expr) bool {
return false
}
// CheckInternalVisibility overrides the given visibility if the package is
// internal.
func CheckInternalVisibility(rel, visibility string) string {
if i := strings.LastIndex(rel, "/internal/"); i >= 0 {
visibility = fmt.Sprintf("//%s:__subpackages__", rel[:i])
} else if strings.HasPrefix(rel, "internal/") {
visibility = "//:__subpackages__"
}
return visibility
}
type byAttrName []KeyValue
var _ sort.Interface = byAttrName{}

View File

@@ -15,13 +15,6 @@ limitations under the License.
package rule
// MergableAttrs is the set of attribute names for each kind of rule that
// may be merged. When an attribute is mergeable, a generated value may
// replace or augment an existing value. If an attribute is not mergeable,
// existing values are preserved. Generated non-mergeable attributes may
// still be added to a rule if there is no corresponding existing attribute.
type MergeableAttrs map[string]map[string]bool
// LoadInfo describes a file that Gazelle knows about and the symbols
// it defines.
type LoadInfo struct {
@@ -30,7 +23,7 @@ type LoadInfo struct {
After []string
}
// KindInfo stores metadata for a kind or fule, for example, "go_library".
// KindInfo stores metadata for a kind of rule, for example, "go_library".
type KindInfo struct {
// MatchAny is true if a rule of this kind may be matched with any rule
// of the same kind, regardless of attributes, if exactly one rule is

View File

@@ -37,21 +37,68 @@ type GlobValue struct {
Excludes []string
}
// BzlExprValue is implemented by types that have custom translations
// to Starlark values.
type BzlExprValue interface {
BzlExpr() bzl.Expr
}
// SelectStringListValue is a value that can be translated to a Bazel
// select expression that picks a string list based on a string condition.
type SelectStringListValue map[string][]string
func (s SelectStringListValue) BzlExpr() bzl.Expr {
defaultKey := "//conditions:default"
keys := make([]string, 0, len(s))
haveDefaultKey := false
for key := range s {
if key == defaultKey {
haveDefaultKey = true
} else {
keys = append(keys, key)
}
}
sort.Strings(keys)
if haveDefaultKey {
keys = append(keys, defaultKey)
}
args := make([]bzl.Expr, 0, len(s))
for _, key := range keys {
value := ExprFromValue(s[key])
if key != defaultKey {
value.(*bzl.ListExpr).ForceMultiLine = true
}
args = append(args, &bzl.KeyValueExpr{
Key: &bzl.StringExpr{Value: key},
Value: value,
})
}
sel := &bzl.CallExpr{
X: &bzl.Ident{Name: "select"},
List: []bzl.Expr{&bzl.DictExpr{List: args, ForceMultiLine: true}},
}
return sel
}
// ExprFromValue converts a value into an expression that can be written into
// a Bazel build file. The following types of values can be converted:
//
// * bools, integers, floats, strings.
// * slices, arrays (converted to lists).
// * maps (converted to select expressions; keys must be rules in
// @io_bazel_rules_go//go/platform).
// * GlobValue (converted to glob expressions).
// * PlatformStrings (converted to a concatenation of a list and selects).
// * bools, integers, floats, strings.
// * slices, arrays (converted to lists).
// * maps (converted to select expressions; keys must be rules in
// @io_bazel_rules_go//go/platform).
// * GlobValue (converted to glob expressions).
// * PlatformStrings (converted to a concatenation of a list and selects).
//
// Converting unsupported types will cause a panic.
func ExprFromValue(val interface{}) bzl.Expr {
if e, ok := val.(bzl.Expr); ok {
return e
}
if be, ok := val.(BzlExprValue); ok {
return be.BzlExpr()
}
rv := reflect.ValueOf(val)
switch rv.Kind() {
@@ -85,23 +132,14 @@ func ExprFromValue(val interface{}) bzl.Expr {
sort.Sort(byString(rkeys))
args := make([]bzl.Expr, len(rkeys))
for i, rk := range rkeys {
label := fmt.Sprintf("@io_bazel_rules_go//go/platform:%s", mapKeyString(rk))
k := &bzl.StringExpr{Value: label}
k := &bzl.StringExpr{Value: mapKeyString(rk)}
v := ExprFromValue(rv.MapIndex(rk).Interface())
if l, ok := v.(*bzl.ListExpr); ok {
l.ForceMultiLine = true
}
args[i] = &bzl.KeyValueExpr{Key: k, Value: v}
}
args = append(args, &bzl.KeyValueExpr{
Key: &bzl.StringExpr{Value: "//conditions:default"},
Value: &bzl.ListExpr{},
})
sel := &bzl.CallExpr{
X: &bzl.LiteralExpr{Token: "select"},
List: []bzl.Expr{&bzl.DictExpr{List: args, ForceMultiLine: true}},
}
return sel
return &bzl.DictExpr{List: args, ForceMultiLine: true}
case reflect.Struct:
switch val := val.(type) {
@@ -119,35 +157,6 @@ func ExprFromValue(val interface{}) bzl.Expr {
X: &bzl.LiteralExpr{Token: "glob"},
List: globArgs,
}
case PlatformStrings:
var pieces []bzl.Expr
if len(val.Generic) > 0 {
pieces = append(pieces, ExprFromValue(val.Generic))
}
if len(val.OS) > 0 {
pieces = append(pieces, ExprFromValue(val.OS))
}
if len(val.Arch) > 0 {
pieces = append(pieces, ExprFromValue(val.Arch))
}
if len(val.Platform) > 0 {
pieces = append(pieces, ExprFromValue(val.Platform))
}
if len(pieces) == 0 {
return &bzl.ListExpr{}
} else if len(pieces) == 1 {
return pieces[0]
} else {
e := pieces[0]
if list, ok := e.(*bzl.ListExpr); ok {
list.ForceMultiLine = true
}
for _, piece := range pieces[1:] {
e = &bzl.BinaryExpr{X: e, Y: piece, Op: "+"}
}
return e
}
}
}
@@ -159,8 +168,6 @@ func mapKeyString(k reflect.Value) string {
switch s := k.Interface().(type) {
case string:
return s
case Platform:
return s.String()
default:
log.Panicf("unexpected map key: %v", k)
return ""

View File

@@ -6,13 +6,14 @@ go_library(
"config.go",
"walk.go",
],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/internal/walk",
importpath = "github.com/bazelbuild/bazel-gazelle/internal/walk",
visibility = ["//vendor/github.com/bazelbuild/bazel-gazelle:__subpackages__"],
importmap = "k8s.io/kubernetes/vendor/github.com/bazelbuild/bazel-gazelle/walk",
importpath = "github.com/bazelbuild/bazel-gazelle/walk",
visibility = ["//visibility:public"],
deps = [
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/config:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/pathtools:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/internal/rule:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/config:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/flag:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/pathtools:go_default_library",
"//vendor/github.com/bazelbuild/bazel-gazelle/rule:go_default_library",
],
)

View File

@@ -19,10 +19,15 @@ import (
"flag"
"path"
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
gzflag "github.com/bazelbuild/bazel-gazelle/flag"
"github.com/bazelbuild/bazel-gazelle/rule"
)
// TODO(#472): store location information to validate each exclude. They
// may be set in one directory and used in another. Excludes work on
// declared generated files, so we can't just stat.
type walkConfig struct {
excludes []string
ignore bool
@@ -36,6 +41,9 @@ func getWalkConfig(c *config.Config) *walkConfig {
}
func (wc *walkConfig) isExcluded(rel, base string) bool {
if base == ".git" {
return true
}
f := path.Join(rel, base)
for _, x := range wc.excludes {
if f == x {
@@ -48,7 +56,9 @@ func (wc *walkConfig) isExcluded(rel, base string) bool {
type Configurer struct{}
func (_ *Configurer) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config) {
c.Exts[walkName] = &walkConfig{}
wc := &walkConfig{}
c.Exts[walkName] = wc
fs.Var(&gzflag.MultiFlag{Values: &wc.excludes}, "exclude", "Path to file or directory that should be ignored (may be repeated)")
}
func (_ *Configurer) CheckFlags(fs *flag.FlagSet, c *config.Config) error { return nil }

View File

@@ -13,6 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package walk provides customizable functionality for visiting each
// subdirectory in a directory tree.
package walk
import (
@@ -23,9 +25,9 @@ import (
"path/filepath"
"strings"
"github.com/bazelbuild/bazel-gazelle/internal/config"
"github.com/bazelbuild/bazel-gazelle/internal/pathtools"
"github.com/bazelbuild/bazel-gazelle/internal/rule"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/pathtools"
"github.com/bazelbuild/bazel-gazelle/rule"
)
// Mode determines which directories Walk visits and which directories
@@ -73,13 +75,33 @@ const (
// "out" and "outs" attributes of rules in f.
type WalkFunc func(dir, rel string, c *config.Config, update bool, f *rule.File, subdirs, regularFiles, genFiles []string)
// Walk traverses the directory tree rooted at c.RepoRoot in depth-first order.
// Walk traverses the directory tree rooted at c.RepoRoot. Walk visits
// subdirectories in depth-first post-order.
//
// Walk calls the Configure method on each configuration extension in cexts
// in each directory in pre-order, whether a build file is present in the
// directory or not. cexts must contain a walk.Configurer.
// When Walk visits a directory, it lists the files and subdirectories within
// that directory. If a build file is present, Walk reads the build file and
// applies any directives to the configuration (a copy of the parent directory's
// configuration is made, and the copy is modified). After visiting
// subdirectories, the callback wf may be called, depending on the mode.
//
// Walk calls the callback wf in post-order.
// c is the root configuration to start with. This includes changes made by
// command line flags, but not by the root build file. This configuration
// should not be modified.
//
// cexts is a list of configuration extensions. When visiting a directory,
// before visiting subdirectories, Walk makes a copy of the parent configuration
// and Configure for each extension on the copy. If Walk sees a directive
// that is not listed in KnownDirectives of any extension, an error will
// be logged.
//
// dirs is a list of absolute, canonical file system paths of directories
// to visit.
//
// mode determines whether subdirectories of dirs should be visited recursively,
// when the wf callback should be called, and when the "update" argument
// to the wf callback should be set.
//
// wf is a function that may be called in each directory.
func Walk(c *config.Config, cexts []config.Configurer, dirs []string, mode Mode, wf WalkFunc) {
knownDirectives := make(map[string]bool)
for _, cext := range cexts {
@@ -114,11 +136,15 @@ func Walk(c *config.Config, cexts []config.Configurer, dirs []string, mode Mode,
c = configure(cexts, knownDirectives, c, rel, f)
wc := getWalkConfig(c)
if wc.isExcluded(rel, ".") {
return
}
var subdirs, regularFiles []string
for _, fi := range files {
base := fi.Name()
switch {
case base == "" || base[0] == '.' || base[0] == '_' || wc.isExcluded(rel, base):
case base == "" || wc.isExcluded(rel, base):
continue
case fi.IsDir() || fi.Mode()&os.ModeSymlink != 0 && symlinks.follow(c, dir, rel, base):

View File

@@ -1,21 +1,13 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: api_proto/api.proto
/*
Package devtools_buildozer is a generated protocol buffer package.
package api_proto
It is generated from these files:
api_proto/api.proto
It has these top-level messages:
Output
RepeatedString
*/
package devtools_buildozer
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
@@ -26,7 +18,7 @@ var _ = math.Inf
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type Output_Record_Field_ERROR int32
@@ -39,6 +31,7 @@ var Output_Record_Field_ERROR_name = map[int32]string{
0: "UNKNOWN",
1: "MISSING",
}
var Output_Record_Field_ERROR_value = map[string]int32{
"UNKNOWN": 0,
"MISSING": 1,
@@ -47,18 +40,42 @@ var Output_Record_Field_ERROR_value = map[string]int32{
func (x Output_Record_Field_ERROR) String() string {
return proto.EnumName(Output_Record_Field_ERROR_name, int32(x))
}
func (Output_Record_Field_ERROR) EnumDescriptor() ([]byte, []int) {
return fileDescriptor0, []int{0, 0, 0, 0}
return fileDescriptor_35e560d0f079cc1d, []int{0, 0, 0, 0}
}
type Output struct {
Records []*Output_Record `protobuf:"bytes,1,rep,name=records" json:"records,omitempty"`
Records []*Output_Record `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Output) Reset() { *m = Output{} }
func (m *Output) String() string { return proto.CompactTextString(m) }
func (*Output) ProtoMessage() {}
func (*Output) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *Output) Reset() { *m = Output{} }
func (m *Output) String() string { return proto.CompactTextString(m) }
func (*Output) ProtoMessage() {}
func (*Output) Descriptor() ([]byte, []int) {
return fileDescriptor_35e560d0f079cc1d, []int{0}
}
func (m *Output) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Output.Unmarshal(m, b)
}
func (m *Output) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Output.Marshal(b, m, deterministic)
}
func (m *Output) XXX_Merge(src proto.Message) {
xxx_messageInfo_Output.Merge(m, src)
}
func (m *Output) XXX_Size() int {
return xxx_messageInfo_Output.Size(m)
}
func (m *Output) XXX_DiscardUnknown() {
xxx_messageInfo_Output.DiscardUnknown(m)
}
var xxx_messageInfo_Output proto.InternalMessageInfo
func (m *Output) GetRecords() []*Output_Record {
if m != nil {
@@ -68,13 +85,36 @@ func (m *Output) GetRecords() []*Output_Record {
}
type Output_Record struct {
Fields []*Output_Record_Field `protobuf:"bytes,1,rep,name=fields" json:"fields,omitempty"`
Fields []*Output_Record_Field `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Output_Record) Reset() { *m = Output_Record{} }
func (m *Output_Record) String() string { return proto.CompactTextString(m) }
func (*Output_Record) ProtoMessage() {}
func (*Output_Record) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} }
func (m *Output_Record) Reset() { *m = Output_Record{} }
func (m *Output_Record) String() string { return proto.CompactTextString(m) }
func (*Output_Record) ProtoMessage() {}
func (*Output_Record) Descriptor() ([]byte, []int) {
return fileDescriptor_35e560d0f079cc1d, []int{0, 0}
}
func (m *Output_Record) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Output_Record.Unmarshal(m, b)
}
func (m *Output_Record) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Output_Record.Marshal(b, m, deterministic)
}
func (m *Output_Record) XXX_Merge(src proto.Message) {
xxx_messageInfo_Output_Record.Merge(m, src)
}
func (m *Output_Record) XXX_Size() int {
return xxx_messageInfo_Output_Record.Size(m)
}
func (m *Output_Record) XXX_DiscardUnknown() {
xxx_messageInfo_Output_Record.DiscardUnknown(m)
}
var xxx_messageInfo_Output_Record proto.InternalMessageInfo
func (m *Output_Record) GetFields() []*Output_Record_Field {
if m != nil {
@@ -89,36 +129,65 @@ type Output_Record_Field struct {
// *Output_Record_Field_Number
// *Output_Record_Field_Error
// *Output_Record_Field_List
Value isOutput_Record_Field_Value `protobuf_oneof:"value"`
// Used internally by Buildozer to decide whether a field should be quoted
// when printing. This does not affect the contents of 'value'.
QuoteWhenPrinting bool `protobuf:"varint,7,opt,name=quote_when_printing,json=quoteWhenPrinting" json:"quote_when_printing,omitempty"`
Value isOutput_Record_Field_Value `protobuf_oneof:"value"`
QuoteWhenPrinting bool `protobuf:"varint,7,opt,name=quote_when_printing,json=quoteWhenPrinting,proto3" json:"quote_when_printing,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Output_Record_Field) Reset() { *m = Output_Record_Field{} }
func (m *Output_Record_Field) String() string { return proto.CompactTextString(m) }
func (*Output_Record_Field) ProtoMessage() {}
func (*Output_Record_Field) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0, 0} }
func (m *Output_Record_Field) Reset() { *m = Output_Record_Field{} }
func (m *Output_Record_Field) String() string { return proto.CompactTextString(m) }
func (*Output_Record_Field) ProtoMessage() {}
func (*Output_Record_Field) Descriptor() ([]byte, []int) {
return fileDescriptor_35e560d0f079cc1d, []int{0, 0, 0}
}
type isOutput_Record_Field_Value interface{ isOutput_Record_Field_Value() }
func (m *Output_Record_Field) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Output_Record_Field.Unmarshal(m, b)
}
func (m *Output_Record_Field) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Output_Record_Field.Marshal(b, m, deterministic)
}
func (m *Output_Record_Field) XXX_Merge(src proto.Message) {
xxx_messageInfo_Output_Record_Field.Merge(m, src)
}
func (m *Output_Record_Field) XXX_Size() int {
return xxx_messageInfo_Output_Record_Field.Size(m)
}
func (m *Output_Record_Field) XXX_DiscardUnknown() {
xxx_messageInfo_Output_Record_Field.DiscardUnknown(m)
}
var xxx_messageInfo_Output_Record_Field proto.InternalMessageInfo
type isOutput_Record_Field_Value interface {
isOutput_Record_Field_Value()
}
type Output_Record_Field_Text struct {
Text string `protobuf:"bytes,1,opt,name=text,oneof"`
}
type Output_Record_Field_Number struct {
Number int32 `protobuf:"varint,2,opt,name=number,oneof"`
}
type Output_Record_Field_Error struct {
Error Output_Record_Field_ERROR `protobuf:"varint,3,opt,name=error,enum=devtools.buildozer.Output_Record_Field_ERROR,oneof"`
}
type Output_Record_Field_List struct {
List *RepeatedString `protobuf:"bytes,5,opt,name=list,oneof"`
Text string `protobuf:"bytes,1,opt,name=text,proto3,oneof"`
}
func (*Output_Record_Field_Text) isOutput_Record_Field_Value() {}
type Output_Record_Field_Number struct {
Number int32 `protobuf:"varint,2,opt,name=number,proto3,oneof"`
}
type Output_Record_Field_Error struct {
Error Output_Record_Field_ERROR `protobuf:"varint,3,opt,name=error,proto3,enum=devtools.buildozer.Output_Record_Field_ERROR,oneof"`
}
type Output_Record_Field_List struct {
List *RepeatedString `protobuf:"bytes,5,opt,name=list,proto3,oneof"`
}
func (*Output_Record_Field_Text) isOutput_Record_Field_Value() {}
func (*Output_Record_Field_Number) isOutput_Record_Field_Value() {}
func (*Output_Record_Field_Error) isOutput_Record_Field_Value() {}
func (*Output_Record_Field_List) isOutput_Record_Field_Value() {}
func (*Output_Record_Field_Error) isOutput_Record_Field_Value() {}
func (*Output_Record_Field_List) isOutput_Record_Field_Value() {}
func (m *Output_Record_Field) GetValue() isOutput_Record_Field_Value {
if m != nil {
@@ -162,9 +231,9 @@ func (m *Output_Record_Field) GetQuoteWhenPrinting() bool {
return false
}
// XXX_OneofFuncs is for the internal use of the proto package.
func (*Output_Record_Field) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _Output_Record_Field_OneofMarshaler, _Output_Record_Field_OneofUnmarshaler, _Output_Record_Field_OneofSizer, []interface{}{
// XXX_OneofWrappers is for the internal use of the proto package.
func (*Output_Record_Field) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*Output_Record_Field_Text)(nil),
(*Output_Record_Field_Number)(nil),
(*Output_Record_Field_Error)(nil),
@@ -172,102 +241,37 @@ func (*Output_Record_Field) XXX_OneofFuncs() (func(msg proto.Message, b *proto.B
}
}
func _Output_Record_Field_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
m := msg.(*Output_Record_Field)
// value
switch x := m.Value.(type) {
case *Output_Record_Field_Text:
b.EncodeVarint(1<<3 | proto.WireBytes)
b.EncodeStringBytes(x.Text)
case *Output_Record_Field_Number:
b.EncodeVarint(2<<3 | proto.WireVarint)
b.EncodeVarint(uint64(x.Number))
case *Output_Record_Field_Error:
b.EncodeVarint(3<<3 | proto.WireVarint)
b.EncodeVarint(uint64(x.Error))
case *Output_Record_Field_List:
b.EncodeVarint(5<<3 | proto.WireBytes)
if err := b.EncodeMessage(x.List); err != nil {
return err
}
case nil:
default:
return fmt.Errorf("Output_Record_Field.Value has unexpected type %T", x)
}
return nil
}
func _Output_Record_Field_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
m := msg.(*Output_Record_Field)
switch tag {
case 1: // value.text
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeStringBytes()
m.Value = &Output_Record_Field_Text{x}
return true, err
case 2: // value.number
if wire != proto.WireVarint {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeVarint()
m.Value = &Output_Record_Field_Number{int32(x)}
return true, err
case 3: // value.error
if wire != proto.WireVarint {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeVarint()
m.Value = &Output_Record_Field_Error{Output_Record_Field_ERROR(x)}
return true, err
case 5: // value.list
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
msg := new(RepeatedString)
err := b.DecodeMessage(msg)
m.Value = &Output_Record_Field_List{msg}
return true, err
default:
return false, nil
}
}
func _Output_Record_Field_OneofSizer(msg proto.Message) (n int) {
m := msg.(*Output_Record_Field)
// value
switch x := m.Value.(type) {
case *Output_Record_Field_Text:
n += proto.SizeVarint(1<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(len(x.Text)))
n += len(x.Text)
case *Output_Record_Field_Number:
n += proto.SizeVarint(2<<3 | proto.WireVarint)
n += proto.SizeVarint(uint64(x.Number))
case *Output_Record_Field_Error:
n += proto.SizeVarint(3<<3 | proto.WireVarint)
n += proto.SizeVarint(uint64(x.Error))
case *Output_Record_Field_List:
s := proto.Size(x.List)
n += proto.SizeVarint(5<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(s))
n += s
case nil:
default:
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
}
return n
}
type RepeatedString struct {
Strings []string `protobuf:"bytes,1,rep,name=strings" json:"strings,omitempty"`
Strings []string `protobuf:"bytes,1,rep,name=strings,proto3" json:"strings,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RepeatedString) Reset() { *m = RepeatedString{} }
func (m *RepeatedString) String() string { return proto.CompactTextString(m) }
func (*RepeatedString) ProtoMessage() {}
func (*RepeatedString) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *RepeatedString) Reset() { *m = RepeatedString{} }
func (m *RepeatedString) String() string { return proto.CompactTextString(m) }
func (*RepeatedString) ProtoMessage() {}
func (*RepeatedString) Descriptor() ([]byte, []int) {
return fileDescriptor_35e560d0f079cc1d, []int{1}
}
func (m *RepeatedString) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RepeatedString.Unmarshal(m, b)
}
func (m *RepeatedString) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RepeatedString.Marshal(b, m, deterministic)
}
func (m *RepeatedString) XXX_Merge(src proto.Message) {
xxx_messageInfo_RepeatedString.Merge(m, src)
}
func (m *RepeatedString) XXX_Size() int {
return xxx_messageInfo_RepeatedString.Size(m)
}
func (m *RepeatedString) XXX_DiscardUnknown() {
xxx_messageInfo_RepeatedString.DiscardUnknown(m)
}
var xxx_messageInfo_RepeatedString proto.InternalMessageInfo
func (m *RepeatedString) GetStrings() []string {
if m != nil {
@@ -277,36 +281,37 @@ func (m *RepeatedString) GetStrings() []string {
}
func init() {
proto.RegisterEnum("devtools.buildozer.Output_Record_Field_ERROR", Output_Record_Field_ERROR_name, Output_Record_Field_ERROR_value)
proto.RegisterType((*Output)(nil), "devtools.buildozer.Output")
proto.RegisterType((*Output_Record)(nil), "devtools.buildozer.Output.Record")
proto.RegisterType((*Output_Record_Field)(nil), "devtools.buildozer.Output.Record.Field")
proto.RegisterType((*RepeatedString)(nil), "devtools.buildozer.RepeatedString")
proto.RegisterEnum("devtools.buildozer.Output_Record_Field_ERROR", Output_Record_Field_ERROR_name, Output_Record_Field_ERROR_value)
}
func init() { proto.RegisterFile("api_proto/api.proto", fileDescriptor0) }
func init() { proto.RegisterFile("api_proto/api.proto", fileDescriptor_35e560d0f079cc1d) }
var fileDescriptor0 = []byte{
// 336 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xc1, 0x4a, 0xf3, 0x40,
0x14, 0x85, 0x33, 0x6d, 0x93, 0xfc, 0xbd, 0x85, 0xd2, 0x7f, 0xea, 0x62, 0xe8, 0x2a, 0xcd, 0xc6,
0x20, 0x38, 0x42, 0xdd, 0x08, 0x2e, 0x04, 0xa1, 0xda, 0x22, 0xa6, 0x32, 0x45, 0xba, 0x2c, 0xa9,
0x19, 0xdb, 0x81, 0x98, 0x89, 0x93, 0x49, 0x15, 0x9f, 0xc3, 0x87, 0xf0, 0xb1, 0x7c, 0x14, 0xc9,
0x24, 0x15, 0x44, 0x41, 0x77, 0xf7, 0xdc, 0x7b, 0xbe, 0x73, 0x42, 0x06, 0xfa, 0x51, 0x26, 0x96,
0x99, 0x92, 0x5a, 0x1e, 0x45, 0x99, 0xa0, 0x66, 0xc2, 0x38, 0xe6, 0x5b, 0x2d, 0x65, 0x92, 0xd3,
0x55, 0x21, 0x92, 0x58, 0xbe, 0x70, 0xe5, 0xbf, 0x35, 0xc1, 0x99, 0x15, 0x3a, 0x2b, 0x34, 0x3e,
0x05, 0x57, 0xf1, 0x3b, 0xa9, 0xe2, 0x9c, 0x20, 0xaf, 0x19, 0x74, 0x46, 0x43, 0xfa, 0x1d, 0xa0,
0x95, 0x99, 0x32, 0xe3, 0x64, 0x3b, 0x62, 0xf0, 0xde, 0x00, 0xa7, 0xda, 0xe1, 0x33, 0x70, 0xee,
0x05, 0x4f, 0x3e, 0x63, 0xf6, 0x7f, 0x8d, 0xa1, 0x17, 0xa5, 0x9f, 0xd5, 0xd8, 0xe0, 0xb5, 0x01,
0xb6, 0xd9, 0xe0, 0x3d, 0x68, 0x69, 0xfe, 0xac, 0x09, 0xf2, 0x50, 0xd0, 0x9e, 0x58, 0xcc, 0x28,
0x4c, 0xc0, 0x49, 0x8b, 0x87, 0x15, 0x57, 0xa4, 0xe1, 0xa1, 0xc0, 0x9e, 0x58, 0xac, 0xd6, 0x78,
0x0c, 0x36, 0x57, 0x4a, 0x2a, 0xd2, 0xf4, 0x50, 0xd0, 0x1d, 0x1d, 0xfe, 0xb1, 0x99, 0x8e, 0x19,
0x9b, 0xb1, 0x89, 0xc5, 0x2a, 0x1a, 0x9f, 0x40, 0x2b, 0x11, 0xb9, 0x26, 0xb6, 0x87, 0x82, 0xce,
0xc8, 0xff, 0x29, 0x85, 0xf1, 0x8c, 0x47, 0x9a, 0xc7, 0x73, 0xad, 0x44, 0xba, 0x2e, 0x3f, 0xad,
0x24, 0x30, 0x85, 0xfe, 0x63, 0x21, 0x35, 0x5f, 0x3e, 0x6d, 0x78, 0xba, 0xcc, 0x94, 0x48, 0xb5,
0x48, 0xd7, 0xc4, 0xf5, 0x50, 0xf0, 0x8f, 0xfd, 0x37, 0xa7, 0xc5, 0x86, 0xa7, 0x37, 0xf5, 0xc1,
0x1f, 0x82, 0x6d, 0xba, 0x71, 0x07, 0xdc, 0xdb, 0xf0, 0x2a, 0x9c, 0x2d, 0xc2, 0x9e, 0x55, 0x8a,
0xeb, 0xe9, 0x7c, 0x3e, 0x0d, 0x2f, 0x7b, 0xe8, 0xdc, 0x05, 0x7b, 0x1b, 0x25, 0x05, 0xf7, 0x0f,
0xa0, 0xfb, 0xb5, 0x15, 0x13, 0x70, 0x73, 0x33, 0x55, 0xbf, 0xba, 0xcd, 0x76, 0x72, 0xe5, 0x98,
0x17, 0x3f, 0xfe, 0x08, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x62, 0x58, 0xc4, 0x08, 0x02, 0x00, 0x00,
var fileDescriptor_35e560d0f079cc1d = []byte{
// 346 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x6a, 0xe3, 0x30,
0x10, 0x86, 0xad, 0x24, 0xb6, 0x37, 0x63, 0x08, 0x59, 0x65, 0x0f, 0x22, 0x27, 0xc7, 0x97, 0x35,
0x0b, 0xab, 0x85, 0xec, 0xa5, 0xd0, 0x43, 0x21, 0x90, 0x36, 0xa1, 0xd4, 0x29, 0x0a, 0x25, 0xd0,
0x4b, 0x70, 0x6a, 0x35, 0x11, 0xb8, 0x96, 0x2b, 0xcb, 0x69, 0xe9, 0x73, 0xf4, 0x21, 0xfa, 0x58,
0x7d, 0x94, 0x62, 0x39, 0x09, 0x94, 0x16, 0xda, 0x93, 0xe6, 0x9f, 0x99, 0xef, 0xff, 0x85, 0x10,
0xf4, 0xe2, 0x5c, 0x2c, 0x73, 0x25, 0xb5, 0xfc, 0x17, 0xe7, 0x82, 0x9a, 0x0a, 0xe3, 0x84, 0x6f,
0xb5, 0x94, 0x69, 0x41, 0x57, 0xa5, 0x48, 0x13, 0xf9, 0xc4, 0x55, 0xf0, 0xd2, 0x04, 0x67, 0x56,
0xea, 0xbc, 0xd4, 0xf8, 0x18, 0x5c, 0xc5, 0x6f, 0xa4, 0x4a, 0x0a, 0x82, 0xfc, 0x66, 0xe8, 0x0d,
0x07, 0xf4, 0x23, 0x40, 0xeb, 0x65, 0xca, 0xcc, 0x26, 0xdb, 0x13, 0xfd, 0xd7, 0x06, 0x38, 0x75,
0x0f, 0x9f, 0x80, 0x73, 0x2b, 0x78, 0x7a, 0xb0, 0xf9, 0xfd, 0xa5, 0x0d, 0x3d, 0xad, 0xf6, 0xd9,
0x0e, 0xeb, 0x3f, 0x37, 0xc0, 0x36, 0x1d, 0xfc, 0x0b, 0x5a, 0x9a, 0x3f, 0x6a, 0x82, 0x7c, 0x14,
0xb6, 0x27, 0x16, 0x33, 0x0a, 0x13, 0x70, 0xb2, 0xf2, 0x6e, 0xc5, 0x15, 0x69, 0xf8, 0x28, 0xb4,
0x27, 0x16, 0xdb, 0x69, 0x3c, 0x06, 0x9b, 0x2b, 0x25, 0x15, 0x69, 0xfa, 0x28, 0xec, 0x0c, 0xff,
0x7e, 0x33, 0x99, 0x8e, 0x19, 0x9b, 0xb1, 0x89, 0xc5, 0x6a, 0x1a, 0x1f, 0x41, 0x2b, 0x15, 0x85,
0x26, 0xb6, 0x8f, 0x42, 0x6f, 0x18, 0x7c, 0xe6, 0xc2, 0x78, 0xce, 0x63, 0xcd, 0x93, 0xb9, 0x56,
0x22, 0x5b, 0x57, 0x57, 0xab, 0x08, 0x4c, 0xa1, 0x77, 0x5f, 0x4a, 0xcd, 0x97, 0x0f, 0x1b, 0x9e,
0x2d, 0x73, 0x25, 0x32, 0x2d, 0xb2, 0x35, 0x71, 0x7d, 0x14, 0xfe, 0x60, 0x3f, 0xcd, 0x68, 0xb1,
0xe1, 0xd9, 0xe5, 0x6e, 0x10, 0x0c, 0xc0, 0x36, 0xd9, 0xd8, 0x03, 0xf7, 0x2a, 0x3a, 0x8f, 0x66,
0x8b, 0xa8, 0x6b, 0x55, 0xe2, 0x62, 0x3a, 0x9f, 0x4f, 0xa3, 0xb3, 0x2e, 0x1a, 0xb9, 0x60, 0x6f,
0xe3, 0xb4, 0xe4, 0xc1, 0x1f, 0xe8, 0xbc, 0x4f, 0xc5, 0x04, 0xdc, 0xc2, 0x54, 0xf5, 0x53, 0xb7,
0xd9, 0x5e, 0x8e, 0xbc, 0xeb, 0xf6, 0xe1, 0x07, 0xac, 0x1c, 0x73, 0xfc, 0x7f, 0x0b, 0x00, 0x00,
0xff, 0xff, 0xa1, 0xc3, 0xf5, 0x19, 0x15, 0x02, 0x00, 0x00,
}

View File

@@ -14,6 +14,8 @@ syntax = "proto3";
package devtools.buildozer;
option go_package = "api_proto";
message Output {
repeated Record records = 1;
message Record {

View File

@@ -15,38 +15,119 @@ distributed under the License is distributed on an "AS IS" BASIS,
limitations under the License.
"""
load(
"@io_bazel_rules_go//go/private:providers.bzl",
"GoSource",
)
_GO_YACC_TOOL = "@org_golang_x_tools//cmd/goyacc"
def go_yacc(src, out, visibility=None):
"""Runs go tool yacc -o $out $src."""
native.genrule(
name = src + ".go_yacc",
srcs = [src],
outs = [out],
tools = [_GO_YACC_TOOL],
cmd = ("export GOROOT=$$(dirname $(location " + _GO_YACC_TOOL + "))/..;" +
" $(location " + _GO_YACC_TOOL + ") " +
" -o $(location " + out + ") $(SRCS)"),
visibility = visibility,
local = 1,
)
def go_yacc(src, out, visibility = None):
"""Runs go tool yacc -o $out $src."""
native.genrule(
name = src + ".go_yacc",
srcs = [src],
outs = [out],
tools = [_GO_YACC_TOOL],
cmd = ("export GOROOT=$$(dirname $(location " + _GO_YACC_TOOL + "))/..;" +
" $(location " + _GO_YACC_TOOL + ") " +
" -o $(location " + out + ") $(SRCS) > /dev/null"),
visibility = visibility,
)
def _extract_go_src(ctx):
"""Thin rule that exposes the GoSource from a go_library."""
return [DefaultInfo(files = depset(ctx.attr.library[GoSource].srcs))]
extract_go_src = rule(
implementation = _extract_go_src,
attrs = {
"library": attr.label(
providers = [GoSource],
),
},
)
def genfile_check_test(src, gen):
"""Asserts that any checked-in generated code matches regen."""
if not src:
fail("src is required", "src")
if not gen:
fail("gen is required", "gen")
native.genrule(
name = src + "_checksh",
outs = [src + "_check.sh"],
cmd = "echo 'diff $$@' > $@",
)
native.sh_test(
name = src + "_checkshtest",
size = "small",
srcs = [src + "_check.sh"],
data = [src, gen],
args = ["$(location " + src + ")", "$(location " + gen + ")"],
)
"""Asserts that any checked-in generated code matches bazel gen."""
if not src:
fail("src is required", "src")
if not gen:
fail("gen is required", "gen")
native.genrule(
name = src + "_checksh",
outs = [src + "_check.sh"],
cmd = r"""cat >$@ <<'eof'
#!/bin/bash
# Script generated by @com_github_bazelbuild_buildtools//build:build_defs.bzl
# --- begin runfiles.bash initialization ---
# Copy-pasted from Bazel's Bash runfiles library (tools/bash/runfiles/runfiles.bash).
set -euo pipefail
if [[ ! -d "$${RUNFILES_DIR:-/dev/null}" && ! -f "$${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then
if [[ -f "$$0.runfiles_manifest" ]]; then
export RUNFILES_MANIFEST_FILE="$$0.runfiles_manifest"
elif [[ -f "$$0.runfiles/MANIFEST" ]]; then
export RUNFILES_MANIFEST_FILE="$$0.runfiles/MANIFEST"
elif [[ -f "$$0.runfiles/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then
export RUNFILES_DIR="$$0.runfiles"
fi
fi
if [[ -f "$${RUNFILES_DIR:-/dev/null}/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then
source "$${RUNFILES_DIR}/bazel_tools/tools/bash/runfiles/runfiles.bash"
elif [[ -f "$${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then
source "$$(grep -m1 "^bazel_tools/tools/bash/runfiles/runfiles.bash " \
"$$RUNFILES_MANIFEST_FILE" | cut -d ' ' -f 2-)"
else
echo >&2 "ERROR: cannot find @bazel_tools//tools/bash/runfiles:runfiles.bash"
exit 1
fi
# --- end runfiles.bash initialization ---
[[ "$$1" = external/* ]] && F1="$${1#external/}" || F1="$$TEST_WORKSPACE/$$1"
[[ "$$2" = external/* ]] && F2="$${2#external/}" || F2="$$TEST_WORKSPACE/$$2"
F1="$$(rlocation "$$F1")"
F2="$$(rlocation "$$F2")"
diff -q "$$F1" "$$F2"
eof
""",
)
native.sh_test(
name = src + "_checkshtest",
size = "small",
srcs = [src + "_check.sh"],
deps = ["@bazel_tools//tools/bash/runfiles"],
data = [src, gen],
args = ["$(location " + src + ")", "$(location " + gen + ")"],
)
# magic copy rule used to update the checked-in version
native.genrule(
name = src + "_copysh",
srcs = [gen],
outs = [src + "copy.sh"],
cmd = "echo 'cp $${BUILD_WORKSPACE_DIRECTORY}/$(location " + gen +
") $${BUILD_WORKSPACE_DIRECTORY}/" + native.package_name() + "/" + src + "' > $@",
)
native.sh_binary(
name = src + "_copy",
srcs = [src + "_copysh"],
data = [gen],
)
def go_proto_checkedin_test(src, proto = "go_default_library"):
"""Asserts that any checked-in .pb.go code matches bazel gen."""
genfile = src + "_genfile"
extract_go_src(
name = genfile + "go",
library = proto,
)
# TODO(pmbethe09): why is the extra copy needed?
native.genrule(
name = genfile,
srcs = [genfile + "go"],
outs = [genfile + ".go"],
cmd = "cp $< $@",
)
genfile_check_test(src, genfile)

View File

@@ -20,18 +20,146 @@ package build
import (
"bytes"
"fmt"
"path/filepath"
"sort"
"strings"
"unicode/utf8"
"github.com/bazelbuild/buildtools/tables"
)
// FileType represents a type of a file (default (for .bzl files), BUILD, or WORKSPACE).
// Certain formatting or refactoring rules can be applied to several file types, so they support
// bitwise operations: `type1 | type2` can represent a scope (e.g. BUILD and WORKSPACE files) and
// `scope & fileType` can be used to check whether a file type belongs to a scope.
type FileType int
const (
// TypeDefault represents general Starlark files
TypeDefault FileType = 1 << iota
// TypeBuild represents BUILD files
TypeBuild
// TypeWorkspace represents WORKSPACE files
TypeWorkspace
// TypeBzl represents .bzl files
TypeBzl
)
func (t FileType) String() string {
switch t {
case TypeDefault:
return "default"
case TypeBuild:
return "BUILD"
case TypeWorkspace:
return "WORKSPACE"
case TypeBzl:
return ".bzl"
}
return "unknown"
}
// ParseBuild parses a file, marks it as a BUILD file and returns the corresponding parse tree.
//
// The filename is used only for generating error messages.
func ParseBuild(filename string, data []byte) (*File, error) {
in := newInput(filename, data)
f, err := in.parse()
if f != nil {
f.Type = TypeBuild
}
return f, err
}
// ParseWorkspace parses a file, marks it as a WORKSPACE file and returns the corresponding parse tree.
//
// The filename is used only for generating error messages.
func ParseWorkspace(filename string, data []byte) (*File, error) {
in := newInput(filename, data)
f, err := in.parse()
if f != nil {
f.Type = TypeWorkspace
}
return f, err
}
// ParseBzl parses a file, marks it as a .bzl file and returns the corresponding parse tree.
//
// The filename is used only for generating error messages.
func ParseBzl(filename string, data []byte) (*File, error) {
in := newInput(filename, data)
f, err := in.parse()
if f != nil {
f.Type = TypeBzl
}
return f, err
}
// ParseDefault parses a file, marks it as a generic Starlark file and returns the corresponding parse tree.
//
// The filename is used only for generating error messages.
func ParseDefault(filename string, data []byte) (*File, error) {
in := newInput(filename, data)
f, err := in.parse()
if f != nil {
f.Type = TypeDefault
}
return f, err
}
func getFileType(filename string) FileType {
if filename == "" { // stdin
return TypeDefault
}
basename := strings.ToLower(filepath.Base(filename))
if strings.HasSuffix(basename, ".oss") {
basename = basename[:len(basename)-4]
}
ext := filepath.Ext(basename)
switch ext {
case ".bzl":
return TypeBzl
case ".sky":
return TypeDefault
}
base := basename[:len(basename)-len(ext)]
switch {
case ext == ".build" || base == "build" || strings.HasPrefix(base, "build."):
return TypeBuild
case ext == ".workspace" || base == "workspace" || strings.HasPrefix(base, "workspace."):
return TypeWorkspace
}
return TypeDefault
}
// Parse parses the input data and returns the corresponding parse tree.
//
// The filename is used only for generating error messages.
// Uses the filename to detect the formatting type (build, workspace, or default) and calls
// ParseBuild, ParseWorkspace, or ParseDefault correspondingly.
func Parse(filename string, data []byte) (*File, error) {
in := newInput(filename, data)
return in.parse()
switch getFileType(filename) {
case TypeBuild:
return ParseBuild(filename, data)
case TypeWorkspace:
return ParseWorkspace(filename, data)
case TypeBzl:
return ParseBzl(filename, data)
}
return ParseDefault(filename, data)
}
// ParseError contains information about the error encountered during parsing.
type ParseError struct {
Message string
Filename string
Pos Position
}
// Error returns a string representation of the parse error.
func (e ParseError) Error() string {
filename := e.Filename
if filename == "" {
filename = "<stdin>"
}
return fmt.Sprintf("%s:%d:%d: %v", filename, e.Pos.Line, e.Pos.LineRune, e.Message)
}
// An input represents a single input file being parsed.
@@ -45,7 +173,6 @@ type input struct {
pos Position // current input position
lineComments []Comment // accumulated line comments
suffixComments []Comment // accumulated suffix comments
endStmt int // position of the end of the current statement
depth int // nesting of [ ] { } ( )
cleanLine bool // true if the current line only contains whitespace before the current position
indent int // current line indentation in spaces
@@ -73,7 +200,6 @@ func newInput(filename string, data []byte) *input {
pos: Position{Line: 1, LineRune: 1, Byte: 0},
cleanLine: true,
indents: []int{0},
endStmt: -1, // -1 denotes it's not inside a statement
}
}
@@ -92,7 +218,7 @@ func (in *input) parse() (f *File, err error) {
if e == in.parseError {
err = in.parseError
} else {
err = fmt.Errorf("%s:%d:%d: internal error: %v", in.filename, in.pos.Line, in.pos.LineRune, e)
err = ParseError{Message: fmt.Sprintf("internal error: %v", e), Filename: in.filename, Pos: in.pos}
}
}
}()
@@ -117,7 +243,7 @@ func (in *input) Error(s string) {
if s == "syntax error" && in.lastToken != "" {
s += " near " + in.lastToken
}
in.parseError = fmt.Errorf("%s:%d:%d: %v", in.filename, in.pos.Line, in.pos.LineRune, s)
in.parseError = ParseError{Message: s, Filename: in.filename, Pos: in.pos}
panic(in.parseError)
}
@@ -187,25 +313,6 @@ func (in *input) Lex(val *yySymType) int {
// Skip past spaces, stopping at non-space or EOF.
countNL := 0 // number of newlines we've skipped past
for !in.eof() {
// If a single statement is split into multiple lines, we don't need
// to track indentations and unindentations within these lines. For example:
//
// def f(
// # This indentation should be ignored
// x):
// # This unindentation should be ignored
// # Actual indentation is from 0 to 2 spaces here
// return x
//
// To handle this case, when we reach the beginning of a statement we scan forward to see where
// it should end and record the number of input bytes remaining at that endpoint.
//
// If --format_bzl is set to false, top level blocks (e.g. an entire function definition)
// is considered as a single statement.
if in.endStmt != -1 && len(in.remaining) == in.endStmt {
in.endStmt = -1
}
// Skip over spaces. Count newlines so we can give the parser
// information about where top-level blank lines are,
// for top-level comment assignment.
@@ -214,7 +321,7 @@ func (in *input) Lex(val *yySymType) int {
if c == '\n' {
in.indent = 0
in.cleanLine = true
if in.endStmt == -1 {
if in.depth == 0 {
// Not in a statememt. Tell parser about top-level blank line.
in.startToken(val)
in.readRune()
@@ -234,18 +341,23 @@ func (in *input) Lex(val *yySymType) int {
// If a line contains just a comment its indentation level doesn't matter.
// Reset it to zero.
in.indent = 0
isLineComment := in.cleanLine
in.cleanLine = true
// Is this comment the only thing on its line?
// Find the last \n before this # and see if it's all
// spaces from there to here.
// If it's a suffix comment but the last non-space symbol before
// it is one of (, [, or {, treat it as a line comment that should be
// it is one of (, [, or {, or it's a suffix comment to "):"
// (e.g. trailing closing bracket or a function definition),
// treat it as a line comment that should be
// put inside the corresponding block.
i := bytes.LastIndex(in.complete[:in.pos.Byte], []byte("\n"))
prefix := bytes.TrimSpace(in.complete[i+1 : in.pos.Byte])
prefix = bytes.Replace(prefix, []byte{' '}, []byte{}, -1)
isSuffix := true
if len(prefix) == 0 ||
(len(prefix) == 2 && prefix[0] == ')' && prefix[1] == ':') ||
prefix[len(prefix)-1] == '[' ||
prefix[len(prefix)-1] == '(' ||
prefix[len(prefix)-1] == '{' {
@@ -266,7 +378,7 @@ func (in *input) Lex(val *yySymType) int {
// If we are at top level (not in a rule), hand the comment to
// the parser as a _COMMENT token. The grammar is written
// to handle top-level comments itself.
if in.endStmt == -1 {
if in.depth == 0 && isLineComment {
// Not in a statement. Tell parser about top-level comment.
return _COMMENT
}
@@ -296,9 +408,9 @@ func (in *input) Lex(val *yySymType) int {
}
// Check for changes in indentation
// Skip if --format_bzl is set to false, if we're inside a statement, or if there were non-space
// Skip if we're inside a statement, or if there were non-space
// characters before in the current line.
if tables.FormatBzlFiles && in.endStmt == -1 && in.cleanLine {
if in.depth == 0 && in.cleanLine {
if in.indent > in.currentIndent() {
// A new indentation block starts
in.indents = append(in.indents, in.indent)
@@ -340,11 +452,6 @@ func (in *input) Lex(val *yySymType) int {
return _EOF
}
// If endStmt is 0, we need to recompute where the end of the next statement is.
if in.endStmt == -1 {
in.endStmt = len(in.skipStmt(in.remaining))
}
// Punctuation tokens.
switch c := in.peekRune(); c {
case '[', '(', '{':
@@ -361,11 +468,35 @@ func (in *input) Lex(val *yySymType) int {
in.readRune()
return c
case '<', '>', '=', '!', '+', '-', '*', '/', '%': // possibly followed by =
case '<', '>', '=', '!', '+', '-', '*', '/', '%', '|', '&', '~', '^': // possibly followed by =
in.readRune()
if c == '/' && in.peekRune() == '/' {
// integer division
if c == '~' {
// unary bitwise not, shouldn't be followed by anything
return c
}
if c == '*' && in.peekRune() == '*' {
// double asterisk
in.readRune()
return _STAR_STAR
}
if c == in.peekRune() {
switch c {
case '/':
// integer division
in.readRune()
c = _INT_DIV
case '<':
// left shift
in.readRune()
c = _BIT_LSH
case '>':
// right shift
in.readRune()
c = _BIT_RSH
}
}
if in.peekRune() == '=' {
@@ -442,7 +573,7 @@ func (in *input) Lex(val *yySymType) int {
}
}
in.endToken(val)
s, triple, err := unquote(val.tok)
s, triple, err := Unquote(val.tok)
if err != nil {
in.Error(fmt.Sprint(err))
}
@@ -456,19 +587,6 @@ func (in *input) Lex(val *yySymType) int {
in.Error(fmt.Sprintf("unexpected input character %#q", c))
}
if !tables.FormatBzlFiles {
// Look for raw Python block (class, def, if, etc at beginning of line) and pass through.
if in.depth == 0 && in.pos.LineRune == 1 && hasPythonPrefix(in.remaining) {
// Find end of Python block and advance input beyond it.
// Have to loop calling readRune in order to maintain line number info.
rest := in.skipStmt(in.remaining)
for len(in.remaining) > len(rest) {
in.readRune()
}
return _PYTHON
}
}
// Scan over alphanumeric identifier.
for {
c := in.peekRune()
@@ -484,7 +602,17 @@ func (in *input) Lex(val *yySymType) int {
if k := keywordToken[val.tok]; k != 0 {
return k
}
switch val.tok {
case "pass":
return _PASS
case "break":
return _BREAK
case "continue":
return _CONTINUE
}
if len(val.tok) > 0 && val.tok[0] >= '0' && val.tok[0] <= '9' {
return _NUMBER
}
return _IDENT
}
@@ -516,164 +644,6 @@ var keywordToken = map[string]int{
"return": _RETURN,
}
// Python scanning.
// About 1% of BUILD files embed arbitrary Python into the file.
// We do not attempt to parse it. Instead, we lex just enough to scan
// beyond it, treating the Python block as an unintepreted blob.
// hasPythonPrefix reports whether p begins with a keyword that would
// introduce an uninterpreted Python block.
func hasPythonPrefix(p []byte) bool {
if tables.FormatBzlFiles {
return false
}
for _, pre := range prefixes {
if hasPrefixSpace(p, pre) {
return true
}
}
return false
}
// These keywords introduce uninterpreted Python blocks.
var prefixes = []string{
"assert",
"class",
"def",
"del",
"for",
"if",
"try",
"else",
"elif",
"except",
}
// hasPrefixSpace reports whether p begins with pre followed by a space or colon.
func hasPrefixSpace(p []byte, pre string) bool {
if len(p) <= len(pre) || p[len(pre)] != ' ' && p[len(pre)] != '\t' && p[len(pre)] != ':' {
return false
}
for i := range pre {
if p[i] != pre[i] {
return false
}
}
return true
}
// A utility function for the legacy formatter.
// Returns whether a given code starts with a top-level statement (maybe with some preceeding
// comments and blank lines)
func isOutsideBlock(b []byte) bool {
isBlankLine := true
isComment := false
for _, c := range b {
switch {
case c == ' ' || c == '\t' || c == '\r':
isBlankLine = false
case c == '#':
isBlankLine = false
isComment = true
case c == '\n':
isBlankLine = true
isComment = false
default:
if !isComment {
return isBlankLine
}
}
}
return true
}
// skipStmt returns the data remaining after the statement beginning at p.
// It does not advance the input position.
// (The only reason for the input receiver is to be able to call in.Error.)
func (in *input) skipStmt(p []byte) []byte {
quote := byte(0) // if non-zero, the kind of quote we're in
tripleQuote := false // if true, the quote is a triple quote
depth := 0 // nesting depth for ( ) [ ] { }
var rest []byte // data after the Python block
defer func() {
if quote != 0 {
in.Error("EOF scanning Python quoted string")
}
}()
// Scan over input one byte at a time until we find
// an unindented, non-blank, non-comment line
// outside quoted strings and brackets.
for i := 0; i < len(p); i++ {
c := p[i]
if quote != 0 && c == quote && !tripleQuote {
quote = 0
continue
}
if quote != 0 && c == quote && tripleQuote && i+2 < len(p) && p[i+1] == quote && p[i+2] == quote {
i += 2
quote = 0
tripleQuote = false
continue
}
if quote != 0 {
if c == '\\' {
i++ // skip escaped char
}
continue
}
if c == '\'' || c == '"' {
if i+2 < len(p) && p[i+1] == c && p[i+2] == c {
quote = c
tripleQuote = true
i += 2
continue
}
quote = c
continue
}
if depth == 0 && i > 0 && p[i] == '\n' && p[i-1] != '\\' {
// Possible stopping point. Save the earliest one we find.
if rest == nil {
rest = p[i:]
}
if tables.FormatBzlFiles {
// In the bzl files mode we only care about the end of the statement, we've found it.
return rest
}
// In the legacy mode we need to find where the current block ends
if isOutsideBlock(p[i+1:]) {
return rest
}
// Not a stopping point after all.
rest = nil
}
switch c {
case '#':
// Skip comment.
for i < len(p) && p[i] != '\n' {
i++
}
// Rewind 1 position back because \n should be handled at the next iteration
i--
case '(', '[', '{':
depth++
case ')', ']', '}':
depth--
}
}
return rest
}
// Comment assignment.
// We build two lists of all subexpressions, preorder and postorder.
// The preorder list is ordered by start location, with outer expressions first.
@@ -707,12 +677,21 @@ func (in *input) order(v Expr) {
in.order(x)
}
in.order(&v.End)
case *PythonBlock:
// nothing
case *LoadStmt:
in.order(v.Module)
for i := range v.From {
in.order(v.To[i])
in.order(v.From[i])
}
in.order(&v.Rparen)
case *LiteralExpr:
// nothing
case *StringExpr:
// nothing
case *Ident:
// nothing
case *BranchStmt:
// nothing
case *DotExpr:
in.order(v.X)
case *ListExpr:
@@ -720,9 +699,9 @@ func (in *input) order(v Expr) {
in.order(x)
}
in.order(&v.End)
case *ListForExpr:
in.order(v.X)
for _, c := range v.For {
case *Comprehension:
in.order(v.Body)
for _, c := range v.Clauses {
in.order(c)
}
in.order(&v.End)
@@ -731,16 +710,9 @@ func (in *input) order(v Expr) {
in.order(x)
}
in.order(&v.End)
case *ForClauseWithIfClausesOpt:
in.order(v.For)
for _, c := range v.Ifs {
in.order(c)
}
case *ForClause:
for _, name := range v.Var {
in.order(name)
}
in.order(v.Expr)
in.order(v.Vars)
in.order(v.X)
case *IfClause:
in.order(v.Cond)
case *KeyValueExpr:
@@ -755,12 +727,17 @@ func (in *input) order(v Expr) {
for _, x := range v.List {
in.order(x)
}
in.order(&v.End)
if !v.NoBrackets {
in.order(&v.End)
}
case *UnaryExpr:
in.order(v.X)
case *BinaryExpr:
in.order(v.X)
in.order(v.Y)
case *AssignExpr:
in.order(v.LHS)
in.order(v.RHS)
case *ConditionalExpr:
in.order(v.Then)
in.order(v.Test)
@@ -777,35 +754,39 @@ func (in *input) order(v Expr) {
in.order(v.X)
in.order(v.Y)
case *LambdaExpr:
for _, name := range v.Var {
in.order(name)
for _, param := range v.Params {
in.order(param)
}
in.order(v.Expr)
case *ReturnExpr:
if v.X != nil {
in.order(v.X)
for _, expr := range v.Body {
in.order(expr)
}
case *FuncDef:
for _, x := range v.Args {
case *ReturnStmt:
if v.Result != nil {
in.order(v.Result)
}
case *DefStmt:
for _, x := range v.Params {
in.order(x)
}
for _, x := range v.Body.Statements {
for _, x := range v.Body {
in.order(x)
}
case *ForLoop:
for _, x := range v.LoopVars {
case *ForStmt:
in.order(v.Vars)
in.order(v.X)
for _, x := range v.Body {
in.order(x)
}
in.order(v.Iterable)
for _, x := range v.Body.Statements {
in.order(x)
case *IfStmt:
in.order(v.Cond)
for _, s := range v.True {
in.order(s)
}
case *IfElse:
for _, condition := range v.Conditions {
in.order(condition.If)
for _, x := range condition.Then.Statements {
in.order(x)
}
if len(v.False) > 0 {
in.order(&v.ElsePos)
}
for _, s := range v.False {
in.order(s)
}
}
if v != nil {
@@ -817,29 +798,19 @@ func (in *input) order(v Expr) {
func (in *input) assignComments() {
// Generate preorder and postorder lists.
in.order(in.file)
in.assignSuffixComments()
in.assignLineComments()
}
// Assign line comments to syntax immediately following.
line := in.lineComments
for _, x := range in.pre {
start, _ := x.Span()
xcom := x.Comment()
for len(line) > 0 && start.Byte >= line[0].Start.Byte {
xcom.Before = append(xcom.Before, line[0])
line = line[1:]
}
}
// Remaining line comments go at end of file.
in.file.After = append(in.file.After, line...)
func (in *input) assignSuffixComments() {
// Assign suffix comments to syntax immediately before.
suffix := in.suffixComments
for i := len(in.post) - 1; i >= 0; i-- {
x := in.post[i]
// Do not assign suffix comments to file
// Do not assign suffix comments to file or to block statements
switch x.(type) {
case *File:
case *File, *DefStmt, *IfStmt, *ForStmt, *CommentBlock:
continue
}
@@ -862,6 +833,27 @@ func (in *input) assignComments() {
in.file.Before = append(in.file.Before, suffix...)
}
func (in *input) assignLineComments() {
// Assign line comments to syntax immediately following.
line := in.lineComments
for _, x := range in.pre {
start, _ := x.Span()
xcom := x.Comment()
for len(line) > 0 && start.Byte >= line[0].Start.Byte {
xcom.Before = append(xcom.Before, line[0])
line = line[1:]
}
// Line comments can be sorted in a wrong order because they get assigned from different
// parts of the lexer and the parser. Restore the original order.
sort.SliceStable(xcom.Before, func(i, j int) bool {
return xcom.Before[i].Start.Byte < xcom.Before[j].Start.Byte
})
}
// Remaining line comments go at end of file.
in.file.After = append(in.file.After, line...)
}
// reverseComments reverses the []Comment list.
func reverseComments(list []Comment) {
for i, j := 0, len(list)-1; i < j; i, j = i+1, j-1 {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -23,19 +23,27 @@ import (
"strings"
)
const nestedIndentation = 2 // Indentation of nested blocks
const listIndentation = 4 // Indentation of multiline expressions
const (
nestedIndentation = 4 // Indentation of nested blocks
listIndentation = 4 // Indentation of multiline expressions
defIndentation = 8 // Indentation of multiline function definitions
)
// Format returns the formatted form of the given BUILD file.
// Format returns the formatted form of the given BUILD or bzl file.
func Format(f *File) []byte {
pr := &printer{}
pr := &printer{fileType: f.Type}
pr.file(f)
return pr.Bytes()
}
// FormatString returns the string form of the given expression.
func FormatString(x Expr) string {
pr := &printer{}
fileType := TypeBuild // for compatibility
if file, ok := x.(*File); ok {
fileType = file.Type
}
pr := &printer{fileType: fileType}
switch x := x.(type) {
case *File:
pr.file(x)
@@ -47,10 +55,13 @@ func FormatString(x Expr) string {
// A printer collects the state during printing of a file or expression.
type printer struct {
fileType FileType // different rules can be applied to different file types.
bytes.Buffer // output buffer
comment []Comment // pending end-of-line comments
margin int // left margin (indent), a number of spaces
depth int // nesting depth inside ( ) [ ] { }
level int // nesting level of def-, if-else- and for-blocks
needsNewLine bool // true if the next statement needs a new line before it
}
// printf prints to the buffer.
@@ -74,6 +85,7 @@ func (p *printer) indent() int {
// To break a line inside an expression that might not be enclosed
// in brackets of some kind, use breakline instead.
func (p *printer) newline() {
p.needsNewLine = false
if len(p.comment) > 0 {
p.printf(" ")
for i, com := range p.comment {
@@ -90,6 +102,28 @@ func (p *printer) newline() {
p.printf("\n%*s", p.margin, "")
}
// softNewline postpones a call to newline to the next call of p.newlineIfNeeded()
// If softNewline is called several times, just one newline is printed.
// Usecase: if there are several nested blocks ending at the same time, for instance
//
// if True:
// for a in b:
// pass
// foo()
//
// the last statement (`pass`) doesn't end with a newline, each block ends with a lazy newline
// which actually gets printed only once when right before the next statement (`foo()`) is printed.
func (p *printer) softNewline() {
p.needsNewLine = true
}
// newlineIfNeeded calls newline if softNewline() has previously been called
func (p *printer) newlineIfNeeded() {
if p.needsNewLine == true {
p.newline()
}
}
// breakline breaks the current line, inserting a continuation \ if needed.
// If no continuation \ is needed, breakline flushes end-of-line comments.
func (p *printer) breakline() {
@@ -128,40 +162,59 @@ func (p *printer) file(f *File) {
p.newline()
}
// If the last expression is in an indented code block there can be spaces in the last line.
p.trim()
p.newlineIfNeeded()
}
func (p *printer) statements(stmts []Expr) {
func (p *printer) nestedStatements(stmts []Expr) {
p.margin += nestedIndentation
p.level++
p.newline()
p.statements(stmts)
p.margin -= nestedIndentation
p.level--
}
func (p *printer) statements(rawStmts []Expr) {
// rawStmts may contain nils if a refactoring tool replaces an actual statement with nil.
// It means the statements don't exist anymore, just ignore them.
stmts := []Expr{}
for _, stmt := range rawStmts {
if stmt != nil {
stmts = append(stmts, stmt)
}
}
for i, stmt := range stmts {
switch stmt := stmt.(type) {
case *CommentBlock:
// comments already handled
case *PythonBlock:
for _, com := range stmt.Before {
p.printf("%s", strings.TrimSpace(com.Token))
p.newline()
}
p.printf("%s", stmt.Token)
p.newline()
default:
p.expr(stmt, precLow)
}
// Print an empty line break after the expression unless it's a code block.
// For a code block, the line break is generated by its last statement.
if !isCodeBlock(stmt) {
p.newline()
}
// A CommentBlock is an empty statement without a body,
// it doesn't need an line break after the body
if _, ok := stmt.(*CommentBlock); !ok {
p.softNewline()
}
for _, com := range stmt.Comment().After {
p.newlineIfNeeded()
p.printf("%s", strings.TrimSpace(com.Token))
p.softNewline()
}
// Print an empty line break after the statement unless it's the last statement in the sequence.
// In that case a line break should be printed when the block or the file ends.
if i < len(stmts)-1 {
p.newline()
}
if i+1 < len(stmts) && !compactStmt(stmt, stmts[i+1], p.margin == 0) {
if i+1 < len(stmts) && !p.compactStmt(stmt, stmts[i+1]) {
p.newline()
}
}
@@ -171,43 +224,58 @@ func (p *printer) statements(stmts []Expr) {
// should be printed without an intervening blank line.
// We omit the blank line when both are subinclude statements
// and the second one has no leading comments.
func compactStmt(s1, s2 Expr, isTopLevel bool) bool {
func (p *printer) compactStmt(s1, s2 Expr) bool {
if len(s2.Comment().Before) > 0 {
return false
}
if isTopLevel {
return isCall(s1, "load") && isCall(s2, "load")
} else if isLoad(s1) && isLoad(s2) {
// Load statements should be compact
return true
} else if isLoad(s1) || isLoad(s2) {
// Load statements should be separated from anything else
return false
} else if isCommentBlock(s1) || isCommentBlock(s2) {
// Standalone comment blocks shouldn't be attached to other statements
return false
} else if (p.fileType == TypeBuild || p.fileType == TypeWorkspace) && p.level == 0 {
// Top-level statements in a BUILD or WORKSPACE file
return false
} else if isFunctionDefinition(s1) || isFunctionDefinition(s2) {
// On of the statements is a function definition
return false
} else {
return !(isCodeBlock(s1) || isCodeBlock(s2))
// Depend on how the statements have been printed in the original file
_, end := s1.Span()
start, _ := s2.Span()
return start.Line-end.Line <= 1
}
}
// isCall reports whether x is a call to a function with the given name.
func isCall(x Expr, name string) bool {
c, ok := x.(*CallExpr)
if !ok {
return false
}
nam, ok := c.X.(*LiteralExpr)
if !ok {
return false
}
return nam.Token == name
// isLoad reports whether x is a load statement.
func isLoad(x Expr) bool {
_, ok := x.(*LoadStmt)
return ok
}
// isCodeBlock checks if the statement is a code block (def, if, for, etc.)
func isCodeBlock(x Expr) bool {
switch x.(type) {
case *FuncDef:
return true
case *ForLoop:
return true
case *IfElse:
return true
default:
// isCommentBlock reports whether x is a comment block node.
func isCommentBlock(x Expr) bool {
_, ok := x.(*CommentBlock)
return ok
}
// isFunctionDefinition checks if the statement is a def code block
func isFunctionDefinition(x Expr) bool {
_, ok := x.(*DefStmt)
return ok
}
// isDifferentLines reports whether two positions belong to different lines.
// If one of the positions is null (Line == 0), it's not a real position but probably an indicator
// of manually inserted node. Return false in this case
func isDifferentLines(p1, p2 *Position) bool {
if p1.Line == 0 || p2.Line == 0 {
return false
}
return p1.Line != p2.Line
}
// Expression formatting.
@@ -236,42 +304,44 @@ func isCodeBlock(x Expr) bool {
const (
precLow = iota
precAssign
precComma
precColon
precIn
precIfElse
precOr
precAnd
precCmp
precBitwiseOr
precBitwiseXor
precBitwiseAnd
precBitwiseShift
precAdd
precMultiply
precSuffix
precUnary
precConcat
precSuffix
)
// opPrec gives the precedence for operators found in a BinaryExpr.
var opPrec = map[string]int{
"=": precAssign,
"+=": precAssign,
"-=": precAssign,
"*=": precAssign,
"/=": precAssign,
"//=": precAssign,
"%=": precAssign,
"or": precOr,
"and": precAnd,
"<": precCmp,
">": precCmp,
"==": precCmp,
"!=": precCmp,
"<=": precCmp,
">=": precCmp,
"+": precAdd,
"-": precAdd,
"*": precMultiply,
"/": precMultiply,
"//": precMultiply,
"%": precMultiply,
"or": precOr,
"and": precAnd,
"in": precCmp,
"not in": precCmp,
"<": precCmp,
">": precCmp,
"==": precCmp,
"!=": precCmp,
"<=": precCmp,
">=": precCmp,
"+": precAdd,
"-": precAdd,
"*": precMultiply,
"/": precMultiply,
"//": precMultiply,
"%": precMultiply,
"|": precBitwiseOr,
"&": precBitwiseAnd,
"^": precBitwiseXor,
"<<": precBitwiseShift,
">>": precBitwiseShift,
}
// expr prints the expression v to the print buffer.
@@ -291,6 +361,8 @@ func (p *printer) expr(v Expr, outerPrec int) {
// TODO(bazel-team): Check whether it is valid to emit comments right now,
// and if not, insert them earlier in the output instead, at the most
// recent \n not following a \ line.
p.newlineIfNeeded()
if before := v.Comment().Before; len(before) > 0 {
// Want to print a line comment.
// Line comments must be at the current margin.
@@ -330,14 +402,19 @@ func (p *printer) expr(v Expr, outerPrec int) {
case *LiteralExpr:
p.printf("%s", v.Token)
case *Ident:
p.printf("%s", v.Name)
case *BranchStmt:
p.printf("%s", v.Token)
case *StringExpr:
// If the Token is a correct quoting of Value, use it.
// This preserves the specific escaping choices that
// BUILD authors have made, and it also works around
// b/7272572.
if strings.HasPrefix(v.Token, `"`) {
s, triple, err := unquote(v.Token)
if s == v.Value && triple == v.TripleQuote && err == nil {
// If the Token is a correct quoting of Value and has double quotes, use it,
// also use it if it has single quotes and the value itself contains a double quote symbol.
// This preserves the specific escaping choices that BUILD authors have made.
s, triple, err := Unquote(v.Token)
if s == v.Value && triple == v.TripleQuote && err == nil {
if strings.HasPrefix(v.Token, `"`) || strings.ContainsRune(v.Value, '"') {
p.printf("%s", v.Token)
break
}
@@ -348,7 +425,16 @@ func (p *printer) expr(v Expr, outerPrec int) {
case *DotExpr:
addParen(precSuffix)
p.expr(v.X, precSuffix)
_, xEnd := v.X.Span()
isMultiline := isDifferentLines(&v.NamePos, &xEnd)
if isMultiline {
p.margin += listIndentation
p.breakline()
}
p.printf(".%s", v.Name)
if isMultiline {
p.margin -= listIndentation
}
case *IndexExpr:
addParen(precSuffix)
@@ -388,19 +474,23 @@ func (p *printer) expr(v Expr, outerPrec int) {
} else {
p.printf("%s", v.Op)
}
p.expr(v.X, precUnary)
// Use the next precedence level (precSuffix), so that nested unary expressions are parenthesized,
// for example: `not (-(+(~foo)))` instead of `not -+~foo`
if v.X != nil {
p.expr(v.X, precSuffix)
}
case *LambdaExpr:
addParen(precColon)
p.printf("lambda ")
for i, name := range v.Var {
for i, param := range v.Params {
if i > 0 {
p.printf(", ")
}
p.expr(name, precLow)
p.expr(param, precLow)
}
p.printf(": ")
p.expr(v.Expr, precColon)
p.expr(v.Body[0], precLow) // lambdas should have exactly one statement
case *BinaryExpr:
// Precedence: use the precedence of the operator.
@@ -423,9 +513,6 @@ func (p *printer) expr(v Expr, outerPrec int) {
m := p.margin
if v.LineBreak {
p.margin = p.indent()
if v.Op == "=" {
p.margin += listIndentation
}
}
p.expr(v.X, prec)
@@ -438,95 +525,165 @@ func (p *printer) expr(v Expr, outerPrec int) {
p.expr(v.Y, prec+1)
p.margin = m
case *AssignExpr:
addParen(precAssign)
m := p.margin
if v.LineBreak {
p.margin = p.indent() + listIndentation
}
p.expr(v.LHS, precAssign)
p.printf(" %s", v.Op)
if v.LineBreak {
p.breakline()
} else {
p.printf(" ")
}
p.expr(v.RHS, precAssign+1)
p.margin = m
case *ParenExpr:
p.seq("()", []Expr{v.X}, &v.End, modeParen, false, v.ForceMultiLine)
p.seq("()", &v.Start, &[]Expr{v.X}, &v.End, modeParen, false, v.ForceMultiLine)
case *CallExpr:
addParen(precSuffix)
p.expr(v.X, precSuffix)
p.seq("()", v.List, &v.End, modeCall, v.ForceCompact, v.ForceMultiLine)
p.seq("()", &v.ListStart, &v.List, &v.End, modeCall, v.ForceCompact, v.ForceMultiLine)
case *LoadStmt:
addParen(precSuffix)
p.printf("load")
args := []Expr{v.Module}
for i := range v.From {
from := v.From[i]
to := v.To[i]
var arg Expr
if from.Name == to.Name {
// Suffix comments are attached to the `to` token,
// Before comments are attached to the `from` token,
// they need to be combined.
arg = from.asString()
arg.Comment().Before = to.Comment().Before
} else {
arg = &AssignExpr{
LHS: to,
Op: "=",
RHS: from.asString(),
}
}
args = append(args, arg)
}
p.seq("()", &v.Load, &args, &v.Rparen, modeLoad, v.ForceCompact, false)
case *ListExpr:
p.seq("[]", v.List, &v.End, modeList, false, v.ForceMultiLine)
p.seq("[]", &v.Start, &v.List, &v.End, modeList, false, v.ForceMultiLine)
case *SetExpr:
p.seq("{}", v.List, &v.End, modeList, false, v.ForceMultiLine)
p.seq("{}", &v.Start, &v.List, &v.End, modeList, false, v.ForceMultiLine)
case *TupleExpr:
p.seq("()", v.List, &v.End, modeTuple, v.ForceCompact, v.ForceMultiLine)
mode := modeTuple
if v.NoBrackets {
mode = modeSeq
}
p.seq("()", &v.Start, &v.List, &v.End, mode, v.ForceCompact, v.ForceMultiLine)
case *DictExpr:
var list []Expr
for _, x := range v.List {
list = append(list, x)
}
p.seq("{}", list, &v.End, modeDict, false, v.ForceMultiLine)
p.seq("{}", &v.Start, &list, &v.End, modeDict, false, v.ForceMultiLine)
case *ListForExpr:
case *Comprehension:
p.listFor(v)
case *ConditionalExpr:
addParen(precSuffix)
p.expr(v.Then, precSuffix)
p.expr(v.Then, precIfElse)
p.printf(" if ")
p.expr(v.Test, precSuffix)
p.expr(v.Test, precIfElse)
p.printf(" else ")
p.expr(v.Else, precSuffix)
p.expr(v.Else, precIfElse)
case *ReturnExpr:
case *ReturnStmt:
p.printf("return")
if v.X != nil {
if v.Result != nil {
p.printf(" ")
p.expr(v.X, precSuffix)
p.expr(v.Result, precLow)
}
case *FuncDef:
case *DefStmt:
p.printf("def ")
p.printf(v.Name)
p.seq("()", v.Args, &v.End, modeCall, v.ForceCompact, v.ForceMultiLine)
p.seq("()", &v.StartPos, &v.Params, nil, modeDef, v.ForceCompact, v.ForceMultiLine)
p.printf(":")
p.margin += nestedIndentation
p.newline()
p.statements(v.Body.Statements)
p.margin -= nestedIndentation
p.nestedStatements(v.Body)
case *ForLoop:
case *ForStmt:
p.printf("for ")
for i, loopVar := range v.LoopVars {
if i > 0 {
p.printf(", ")
}
p.expr(loopVar, precLow)
}
p.expr(v.Vars, precLow)
p.printf(" in ")
p.expr(v.Iterable, precLow)
p.expr(v.X, precLow)
p.printf(":")
p.margin += nestedIndentation
p.newline()
p.statements(v.Body.Statements)
p.margin -= nestedIndentation
p.nestedStatements(v.Body)
case *IfElse:
for i, block := range v.Conditions {
if i == 0 {
p.printf("if ")
} else if block.If == nil {
p.newline()
p.printf("else")
} else {
p.newline()
p.printf("elif ")
}
if block.If != nil {
p.expr(block.If, precLow)
case *IfStmt:
block := v
isFirst := true
needsEmptyLine := false
for {
p.newlineIfNeeded()
if !isFirst {
if needsEmptyLine {
p.newline()
}
p.printf("el")
}
p.printf("if ")
p.expr(block.Cond, precLow)
p.printf(":")
p.margin += nestedIndentation
p.newline()
p.statements(block.Then.Statements)
p.margin -= nestedIndentation
p.nestedStatements(block.True)
isFirst = false
_, end := block.True[len(block.True)-1].Span()
needsEmptyLine = block.ElsePos.Pos.Line-end.Line > 1
// If the else-block contains just one statement which is an IfStmt, flatten it as a part
// of if-elif chain.
// Don't do it if the "else" statement has a suffix comment or if the next "if" statement
// has a before-comment.
if len(block.False) != 1 {
break
}
next, ok := block.False[0].(*IfStmt)
if !ok {
break
}
if len(block.ElsePos.Comment().Suffix) == 0 && len(next.Comment().Before) == 0 {
block = next
continue
}
break
}
if len(block.False) > 0 {
p.newlineIfNeeded()
if needsEmptyLine {
p.newline()
}
p.printf("else:")
p.comment = append(p.comment, block.ElsePos.Comment().Suffix...)
p.nestedStatements(block.False)
}
case *ForClause:
p.printf("for ")
p.expr(v.Vars, precLow)
p.printf(" in ")
p.expr(v.X, precLow)
case *IfClause:
p.printf("if ")
p.expr(v.Cond, precLow)
}
// Add closing parenthesis if needed.
@@ -553,87 +710,159 @@ const (
modeParen // (x)
modeDict // {x:y}
modeSeq // x, y
modeDef // def f(x, y)
modeLoad // load(a, b, c)
)
// useCompactMode reports whether a sequence should be formatted in a compact mode
func (p *printer) useCompactMode(start *Position, list *[]Expr, end *End, mode seqMode, forceCompact, forceMultiLine bool) bool {
// If there are line comments, use multiline
// so we can print the comments before the closing bracket.
for _, x := range *list {
if len(x.Comment().Before) > 0 || (len(x.Comment().Suffix) > 0 && mode != modeDef) {
return false
}
}
if end != nil && len(end.Before) > 0 {
return false
}
// Implicit tuples are always compact
if mode == modeSeq {
return true
}
// In the Default and .bzl printing modes try to keep the original printing style.
// Non-top-level statements and lists of arguments of a function definition
// should also keep the original style regardless of the mode.
if (p.level != 0 || p.fileType == TypeDefault || p.fileType == TypeBzl || mode == modeDef) && mode != modeLoad {
// If every element (including the brackets) ends on the same line where the next element starts,
// use the compact mode, otherwise use multiline mode.
// If an node's line number is 0, it means it doesn't appear in the original file,
// its position shouldn't be taken into account. Unless a sequence is new,
// then use multiline mode if ForceMultiLine mode was set.
previousEnd := start
isNewSeq := start.Line == 0
for _, x := range *list {
start, end := x.Span()
isNewSeq = isNewSeq && start.Line == 0
if isDifferentLines(&start, previousEnd) {
return false
}
if end.Line != 0 {
previousEnd = &end
}
}
if end != nil {
isNewSeq = isNewSeq && end.Pos.Line == 0
if isDifferentLines(previousEnd, &end.Pos) {
return false
}
}
if !isNewSeq {
return true
}
// Use the forceMultiline value for new sequences.
return !forceMultiLine
}
// In Build mode, use the forceMultiline and forceCompact values
if forceMultiLine {
return false
}
if forceCompact {
return true
}
// If neither of the flags are set, use compact mode only for empty or 1-element sequences
return len(*list) <= 1
}
// seq formats a list of values inside a given bracket pair (brack = "()", "[]", "{}").
// The end node holds any trailing comments to be printed just before the
// closing bracket.
// The mode parameter specifies the sequence mode (see above).
// If multiLine is true, seq avoids the compact form even
// for 0- and 1-element sequences.
func (p *printer) seq(brack string, list []Expr, end *End, mode seqMode, forceCompact, forceMultiLine bool) {
p.printf("%s", brack[:1])
func (p *printer) seq(brack string, start *Position, list *[]Expr, end *End, mode seqMode, forceCompact, forceMultiLine bool) {
if mode != modeSeq {
p.printf("%s", brack[:1])
}
p.depth++
// If there are line comments, force multiline
// so we can print the comments before the closing bracket.
for _, x := range list {
if len(x.Comment().Before) > 0 {
forceMultiLine = true
defer func() {
p.depth--
if mode != modeSeq {
p.printf("%s", brack[1:])
}
}
if len(end.Before) > 0 {
forceMultiLine = true
}
}()
// Resolve possibly ambiguous call arguments explicitly
// instead of depending on implicit resolution in logic below.
if forceMultiLine {
forceCompact = false
}
switch {
case len(list) == 0 && !forceMultiLine:
// Compact form: print nothing.
case len(list) == 1 && !forceMultiLine:
// Compact form.
p.expr(list[0], precLow)
// Tuple must end with comma, to mark it as a tuple.
if mode == modeTuple {
p.printf(",")
}
case forceCompact:
// Compact form but multiple elements.
for i, x := range list {
if p.useCompactMode(start, list, end, mode, forceCompact, forceMultiLine) {
for i, x := range *list {
if i > 0 {
p.printf(", ")
}
p.expr(x, precLow)
}
default:
// Multi-line form.
p.margin += listIndentation
for i, x := range list {
// If we are about to break the line before the first
// element and there are trailing end-of-line comments
// waiting to be printed, delay them and print them as
// whole-line comments preceding that element.
// Do this by printing a newline ourselves and positioning
// so that the end-of-line comment, with the two spaces added,
// will line up with the current margin.
if i == 0 && len(p.comment) > 0 {
p.printf("\n%*s", p.margin-2, "")
}
p.newline()
p.expr(x, precLow)
if mode != modeParen || i+1 < len(list) {
p.printf(",")
}
// Single-element tuple must end with comma, to mark it as a tuple.
if len(*list) == 1 && mode == modeTuple {
p.printf(",")
}
// Final comments.
return
}
// Multi-line form.
indentation := listIndentation
if mode == modeDef {
indentation = defIndentation
}
p.margin += indentation
for i, x := range *list {
// If we are about to break the line before the first
// element and there are trailing end-of-line comments
// waiting to be printed, delay them and print them as
// whole-line comments preceding that element.
// Do this by printing a newline ourselves and positioning
// so that the end-of-line comment, with the two spaces added,
// will line up with the current margin.
if i == 0 && len(p.comment) > 0 {
p.printf("\n%*s", p.margin-2, "")
}
p.newline()
p.expr(x, precLow)
if i+1 < len(*list) || needsTrailingComma(mode, x) {
p.printf(",")
}
}
// Final comments.
if end != nil {
for _, com := range end.Before {
p.newline()
p.printf("%s", strings.TrimSpace(com.Token))
}
p.margin -= listIndentation
}
p.margin -= indentation
// in modeDef print the closing bracket on the same line
if mode != modeDef {
p.newline()
}
p.depth--
p.printf("%s", brack[1:])
}
func needsTrailingComma(mode seqMode, v Expr) bool {
switch mode {
case modeDef:
return false
case modeParen:
return false
case modeCall:
// *args and **kwargs in fn calls
switch v := v.(type) {
case *UnaryExpr:
if v.Op == "*" || v.Op == "**" {
return false
}
}
}
return true
}
// listFor formats a ListForExpr (list comprehension).
@@ -647,7 +876,7 @@ func (p *printer) seq(brack string, list []Expr, end *End, mode seqMode, forceCo
// if c
// ]
//
func (p *printer) listFor(v *ListForExpr) {
func (p *printer) listFor(v *Comprehension) {
multiLine := v.ForceMultiLine || len(v.End.Before) > 0
// space breaks the line in multiline mode
@@ -660,41 +889,23 @@ func (p *printer) listFor(v *ListForExpr) {
}
}
if v.Brack != "" {
p.depth++
p.printf("%s", v.Brack[:1])
open, close := "[", "]"
if v.Curly {
open, close = "{", "}"
}
p.depth++
p.printf("%s", open)
if multiLine {
if v.Brack != "" {
p.margin += listIndentation
}
p.margin += listIndentation
p.newline()
}
p.expr(v.X, precLow)
p.expr(v.Body, precLow)
for _, c := range v.For {
for _, c := range v.Clauses {
space()
p.printf("for ")
for i, name := range c.For.Var {
if i > 0 {
p.printf(", ")
}
p.expr(name, precLow)
}
p.printf(" in ")
p.expr(c.For.Expr, precLow)
p.comment = append(p.comment, c.For.Comment().Suffix...)
for _, i := range c.Ifs {
space()
p.printf("if ")
p.expr(i.Cond, precLow)
p.comment = append(p.comment, i.Comment().Suffix...)
}
p.comment = append(p.comment, c.Comment().Suffix...)
p.expr(c, precLow)
}
if multiLine {
@@ -702,16 +913,12 @@ func (p *printer) listFor(v *ListForExpr) {
p.newline()
p.printf("%s", strings.TrimSpace(com.Token))
}
if v.Brack != "" {
p.margin -= listIndentation
}
p.margin -= listIndentation
p.newline()
}
if v.Brack != "" {
p.printf("%s", v.Brack[1:])
p.depth--
}
p.printf("%s", close)
p.depth--
}
func (p *printer) isTopLevel() bool {

View File

@@ -59,10 +59,10 @@ var esc = [256]byte{
// being used as shell arguments containing regular expressions.
const notEsc = " !#$%&()*+,-./:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~"
// unquote unquotes the quoted string, returning the actual
// Unquote unquotes the quoted string, returning the actual
// string value, whether the original was triple-quoted, and
// an error describing invalid input.
func unquote(quoted string) (s string, triple bool, err error) {
func Unquote(quoted string) (s string, triple bool, err error) {
// Check for raw prefix: means don't interpret the inner \.
raw := false
if strings.HasPrefix(quoted, "r") {

View File

@@ -18,12 +18,12 @@ distributed under the License is distributed on an "AS IS" BASIS,
package build
import (
"github.com/bazelbuild/buildtools/tables"
"path"
"path/filepath"
"regexp"
"sort"
"strings"
"github.com/bazelbuild/buildtools/tables"
)
// For debugging: flag to disable certain rewrites.
@@ -62,55 +62,78 @@ func Rewrite(f *File, info *RewriteInfo) {
for _, r := range rewrites {
if !disabled(r.name) {
r.fn(f, info)
if f.Type&r.scope != 0 {
r.fn(f, info)
}
}
}
}
// RewriteInfo collects information about what Rewrite did.
type RewriteInfo struct {
EditLabel int // number of label strings edited
NameCall int // number of calls with argument names added
SortCall int // number of call argument lists sorted
SortStringList int // number of string lists sorted
UnsafeSort int // number of unsafe string lists sorted
Log []string // log entries - may change
EditLabel int // number of label strings edited
NameCall int // number of calls with argument names added
SortCall int // number of call argument lists sorted
SortStringList int // number of string lists sorted
UnsafeSort int // number of unsafe string lists sorted
SortLoad int // number of load argument lists sorted
FormatDocstrings int // number of reindented docstrings
ReorderArguments int // number of reordered function call arguments
EditOctal int // number of edited octals
Log []string // log entries - may change
}
func (info *RewriteInfo) String() string {
s := ""
if info.EditLabel > 0 {
s += " label"
// Stats returns a map with statistics about applied rewrites
func (info *RewriteInfo) Stats() map[string]int {
return map[string]int{
"label": info.EditLabel,
"callname": info.NameCall,
"callsort": info.SortCall,
"listsort": info.SortStringList,
"unsafesort": info.UnsafeSort,
"sortload": info.SortLoad,
"formatdocstrings": info.FormatDocstrings,
"reorderarguments": info.ReorderArguments,
"editoctal": info.EditOctal,
}
if info.NameCall > 0 {
s += " callname"
}
if info.SortCall > 0 {
s += " callsort"
}
if info.SortStringList > 0 {
s += " listsort"
}
if info.UnsafeSort > 0 {
s += " unsafesort"
}
if s != "" {
s = s[1:]
}
return s
}
// Each rewrite function can be either applied for BUILD files, other files (such as .bzl),
// or all files.
const (
scopeDefault = TypeDefault | TypeBzl // .bzl and generic Starlark files
scopeBuild = TypeBuild | TypeWorkspace // BUILD and WORKSPACE files
scopeBoth = scopeDefault | scopeBuild
)
// rewrites is the list of all Buildifier rewrites, in the order in which they are applied.
// The order here matters: for example, label canonicalization must happen
// before sorting lists of strings.
var rewrites = []struct {
name string
fn func(*File, *RewriteInfo)
name string
fn func(*File, *RewriteInfo)
scope FileType
}{
{"callsort", sortCallArgs},
{"label", fixLabels},
{"listsort", sortStringLists},
{"multiplus", fixMultilinePlus},
{"callsort", sortCallArgs, scopeBuild},
{"label", fixLabels, scopeBuild},
{"listsort", sortStringLists, scopeBoth},
{"multiplus", fixMultilinePlus, scopeBuild},
{"loadsort", sortAllLoadArgs, scopeBoth},
{"formatdocstrings", formatDocstrings, scopeBoth},
{"reorderarguments", reorderArguments, scopeBoth},
{"editoctal", editOctals, scopeBoth},
}
// DisableLoadSortForBuildFiles disables the loadsort transformation for BUILD files.
// This is a temporary function for backward compatibility, can be called if there's plenty of
// already formatted BUILD files that shouldn't be changed by the transformation.
func DisableLoadSortForBuildFiles() {
for i := range rewrites {
if rewrites[i].name == "loadsort" {
rewrites[i].scope = scopeDefault
break
}
}
}
// leaveAlone reports whether any of the nodes on the stack are marked
@@ -212,14 +235,19 @@ func fixLabels(f *File, info *RewriteInfo) {
editPerformed := false
if tables.StripLabelLeadingSlashes && strings.HasPrefix(str.Value, "//") {
if path.Dir(f.Path) == "." || !strings.HasPrefix(str.Value, "//:") {
if filepath.Dir(f.Path) == "." || !strings.HasPrefix(str.Value, "//:") {
editPerformed = true
str.Value = str.Value[2:]
}
}
if tables.ShortenAbsoluteLabelsToRelative {
thisPackage := labelPrefix + path.Dir(f.Path)
thisPackage := labelPrefix + filepath.Dir(f.Path)
// filepath.Dir on Windows uses backslashes as separators, while labels always have slashes.
if filepath.Separator != '/' {
thisPackage = strings.Replace(thisPackage, string(filepath.Separator), "/", -1)
}
if str.Value == thisPackage {
editPerformed = true
str.Value = ":" + path.Base(str.Value)
@@ -255,18 +283,18 @@ func fixLabels(f *File, info *RewriteInfo) {
if leaveAlone1(v.List[i]) {
continue
}
as, ok := v.List[i].(*BinaryExpr)
if !ok || as.Op != "=" {
as, ok := v.List[i].(*AssignExpr)
if !ok {
continue
}
key, ok := as.X.(*LiteralExpr)
if !ok || !tables.IsLabelArg[key.Token] || tables.LabelBlacklist[callName(v)+"."+key.Token] {
key, ok := as.LHS.(*Ident)
if !ok || !tables.IsLabelArg[key.Name] || tables.LabelBlacklist[callName(v)+"."+key.Name] {
continue
}
if leaveAlone1(as.Y) {
if leaveAlone1(as.RHS) {
continue
}
if list, ok := as.Y.(*ListExpr); ok {
if list, ok := as.RHS.(*ListExpr); ok {
for i := range list.List {
if leaveAlone1(list.List[i]) {
continue
@@ -275,7 +303,7 @@ func fixLabels(f *File, info *RewriteInfo) {
shortenLabel(list.List[i])
}
}
if set, ok := as.Y.(*SetExpr); ok {
if set, ok := as.RHS.(*SetExpr); ok {
for i := range set.List {
if leaveAlone1(set.List[i]) {
continue
@@ -284,8 +312,8 @@ func fixLabels(f *File, info *RewriteInfo) {
shortenLabel(set.List[i])
}
} else {
joinLabel(&as.Y)
shortenLabel(as.Y)
joinLabel(&as.RHS)
shortenLabel(as.RHS)
}
}
}
@@ -295,11 +323,11 @@ func fixLabels(f *File, info *RewriteInfo) {
// callName returns the name of the rule being called by call.
// If the call is not to a literal rule name, callName returns "".
func callName(call *CallExpr) string {
rule, ok := call.X.(*LiteralExpr)
rule, ok := call.X.(*Ident)
if !ok {
return ""
}
return rule.Token
return rule.Name
}
// sortCallArgs sorts lists of named arguments to a call.
@@ -368,9 +396,9 @@ func ruleNamePriority(rule, arg string) int {
// If x is of the form key=value, argName returns the string key.
// Otherwise argName returns "".
func argName(x Expr) string {
if as, ok := x.(*BinaryExpr); ok && as.Op == "=" {
if id, ok := as.X.(*LiteralExpr); ok {
return id.Token
if as, ok := x.(*AssignExpr); ok {
if id, ok := as.LHS.(*Ident); ok {
return id.Name
}
}
return ""
@@ -416,31 +444,31 @@ func sortStringLists(f *File, info *RewriteInfo) {
if leaveAlone1(arg) {
continue
}
as, ok := arg.(*BinaryExpr)
if !ok || as.Op != "=" || leaveAlone1(as) || doNotSort(as) {
as, ok := arg.(*AssignExpr)
if !ok || leaveAlone1(as) || doNotSort(as) {
continue
}
key, ok := as.X.(*LiteralExpr)
key, ok := as.LHS.(*Ident)
if !ok {
continue
}
context := rule + "." + key.Token
if !tables.IsSortableListArg[key.Token] || tables.SortableBlacklist[context] {
context := rule + "." + key.Name
if !tables.IsSortableListArg[key.Name] || tables.SortableBlacklist[context] || f.Type == TypeDefault || f.Type == TypeBzl {
continue
}
if disabled("unsafesort") && !tables.SortableWhitelist[context] && !allowedSort(context) {
continue
}
sortStringList(as.Y, info, context)
sortStringList(as.RHS, info, context)
}
case *BinaryExpr:
case *AssignExpr:
if disabled("unsafesort") {
return
}
// "keep sorted" comment on x = list forces sorting of list.
as := v
if as.Op == "=" && keepSorted(as) {
sortStringList(as.Y, info, "?")
if keepSorted(as) {
sortStringList(as.RHS, info, "?")
}
case *KeyValueExpr:
if disabled("unsafesort") {
@@ -455,7 +483,7 @@ func sortStringLists(f *File, info *RewriteInfo) {
return
}
// "keep sorted" comment above first list element also forces sorting of list.
if len(v.List) > 0 && keepSorted(v.List[0]) {
if len(v.List) > 0 && (keepSorted(v) || keepSorted(v.List[0])) {
sortStringList(v, info, "?")
}
}
@@ -476,7 +504,7 @@ func sortStringList(x Expr, info *RewriteInfo, context string) {
return
}
forceSort := keepSorted(list.List[0])
forceSort := keepSorted(list) || keepSorted(list.List[0])
// TODO(bazel-team): Decide how to recognize lists that cannot
// be sorted. Avoiding all lists with comments avoids sorting
@@ -569,11 +597,11 @@ func callArgName(stk []Expr) string {
if !ok {
return ""
}
rule, ok := call.X.(*LiteralExpr)
rule, ok := call.X.(*Ident)
if !ok {
return ""
}
return rule.Token + "." + arg
return rule.Name + "." + arg
}
// A stringSortKey records information about a single string literal to be
@@ -794,6 +822,17 @@ func fixMultilinePlus(f *File, info *RewriteInfo) {
})
}
// sortAllLoadArgs sorts all load arguments in the file
func sortAllLoadArgs(f *File, info *RewriteInfo) {
Walk(f, func(v Expr, stk []Expr) {
if load, ok := v.(*LoadStmt); ok {
if SortLoadArgs(load) {
info.SortLoad++
}
}
})
}
// hasComments reports whether any comments are associated with
// the list or its elements.
func hasComments(list *ListExpr) (line, suffix bool) {
@@ -815,3 +854,149 @@ func hasComments(list *ListExpr) (line, suffix bool) {
}
return
}
// A wrapper for a LoadStmt's From and To slices for consistent sorting of their contents.
// It's assumed that the following slices have the same length. The contents are sorted by
// the `To` attribute, but all items with equal "From" and "To" parts are placed before the items
// with different parts.
type loadArgs struct {
From []*Ident
To []*Ident
modified bool
}
func (args loadArgs) Len() int {
return len(args.From)
}
func (args loadArgs) Swap(i, j int) {
args.From[i], args.From[j] = args.From[j], args.From[i]
args.To[i], args.To[j] = args.To[j], args.To[i]
args.modified = true
}
func (args loadArgs) Less(i, j int) bool {
// Arguments with equal "from" and "to" parts are prioritized
equalI := args.From[i].Name == args.To[i].Name
equalJ := args.From[j].Name == args.To[j].Name
if equalI != equalJ {
// If equalI and !equalJ, return true, otherwise false.
// Equivalently, return equalI.
return equalI
}
return args.To[i].Name < args.To[j].Name
}
// SortLoadArgs sorts a load statement arguments (lexicographically, but positional first)
func SortLoadArgs(load *LoadStmt) bool {
args := loadArgs{From: load.From, To: load.To}
sort.Sort(args)
return args.modified
}
// formatDocstrings fixes the indentation and trailing whitespace of docstrings
func formatDocstrings(f *File, info *RewriteInfo) {
Walk(f, func(v Expr, stk []Expr) {
def, ok := v.(*DefStmt)
if !ok || len(def.Body) == 0 {
return
}
docstring, ok := def.Body[0].(*StringExpr)
if !ok || !docstring.TripleQuote {
return
}
oldIndentation := docstring.Start.LineRune - 1 // LineRune starts with 1
newIndentation := nestedIndentation * len(stk)
// Operate on Token, not Value, because their line breaks can be different if a line ends with
// a backslash.
updatedToken := formatString(docstring.Token, oldIndentation, newIndentation)
if updatedToken != docstring.Token {
docstring.Token = updatedToken
// Update the value to keep it consistent with Token
docstring.Value, _, _ = Unquote(updatedToken)
info.FormatDocstrings++
}
})
}
// formatString modifies a string value of a docstring to match the new indentation level and
// to remove trailing whitespace from its lines.
func formatString(value string, oldIndentation, newIndentation int) string {
difference := newIndentation - oldIndentation
lines := strings.Split(value, "\n")
for i, line := range lines {
if i == 0 {
// The first line shouldn't be touched because it starts right after ''' or """
continue
}
if difference > 0 {
line = strings.Repeat(" ", difference) + line
} else {
for i, rune := range line {
if i == -difference || rune != ' ' {
line = line[i:]
break
}
}
}
if i != len(lines)-1 {
// Remove trailing space from the line unless it's the last line that's responsible
// for the indentation of the closing `"""`
line = strings.TrimRight(line, " ")
}
lines[i] = line
}
return strings.Join(lines, "\n")
}
// argumentType returns an integer by which funcall arguments can be sorted:
// 1 for positional, 2 for named, 3 for *args, 4 for **kwargs
func argumentType(expr Expr) int {
switch expr := expr.(type) {
case *UnaryExpr:
switch expr.Op {
case "**":
return 4
case "*":
return 3
}
case *AssignExpr:
return 2
}
return 1
}
// reorderArguments fixes the order of arguments of a function call
// (positional, named, *args, **kwargs)
func reorderArguments(f *File, info *RewriteInfo) {
Walk(f, func(expr Expr, stack []Expr) {
call, ok := expr.(*CallExpr)
if !ok {
return
}
compare := func(i, j int) bool {
return argumentType(call.List[i]) < argumentType(call.List[j])
}
if !sort.SliceIsSorted(call.List, compare) {
sort.SliceStable(call.List, compare)
info.ReorderArguments++
}
})
}
// editOctals inserts 'o' into octal numbers to make it more obvious they are octal
// 0123 -> 0o123
func editOctals(f *File, info *RewriteInfo) {
Walk(f, func(expr Expr, stack []Expr) {
l, ok := expr.(*LiteralExpr)
if !ok {
return
}
if len(l.Token) > 1 && l.Token[0] == '0' && l.Token[1] >= '0' && l.Token[1] <= '9' {
l.Token = "0o" + l.Token[1:]
info.EditOctal++
}
})
}

View File

@@ -19,8 +19,8 @@ distributed under the License is distributed on an "AS IS" BASIS,
package build
import (
"strings"
"path/filepath"
"strings"
)
// A Rule represents a single BUILD rule.
@@ -29,6 +29,11 @@ type Rule struct {
ImplicitName string // The name which should be used if the name attribute is not set. See the comment on File.implicitRuleName.
}
// NewRule is a simple constructor for Rule.
func NewRule(call *CallExpr) *Rule {
return &Rule{call, ""}
}
func (f *File) Rule(call *CallExpr) *Rule {
r := &Rule{call, ""}
if r.AttrString("name") == "" {
@@ -43,15 +48,26 @@ func (f *File) Rules(kind string) []*Rule {
var all []*Rule
for _, stmt := range f.Stmt {
call, ok := stmt.(*CallExpr)
if !ok {
continue
}
rule := f.Rule(call)
if kind != "" && rule.Kind() != kind {
continue
}
all = append(all, rule)
Walk(stmt, func(x Expr, stk []Expr) {
call, ok := x.(*CallExpr)
if !ok {
return
}
// Skip nested calls.
for _, frame := range stk {
if _, ok := frame.(*CallExpr); ok {
return
}
}
// Check if the rule kind is correct.
rule := f.Rule(call)
if kind != "" && rule.Kind() != kind {
return
}
all = append(all, rule)
})
}
return all
@@ -145,11 +161,11 @@ func (r *Rule) Kind() string {
names = append(names, x.Name)
expr = x.X
}
x, ok := expr.(*LiteralExpr)
x, ok := expr.(*Ident)
if !ok {
return ""
}
names = append(names, x.Token)
names = append(names, x.Name)
// Reverse the elements since the deepest expression contains the leading literal
for l, r := 0, len(names)-1; l < r; l, r = l+1, r-1 {
names[l], names[r] = names[r], names[l]
@@ -161,18 +177,23 @@ func (r *Rule) Kind() string {
func (r *Rule) SetKind(kind string) {
names := strings.Split(kind, ".")
var expr Expr
expr = &LiteralExpr{Token: names[0]}
expr = &Ident{Name: names[0]}
for _, name := range names[1:] {
expr = &DotExpr{X: expr, Name: name}
}
r.Call.X = expr
}
// ExplicitName returns the rule's target name if it's explicitly provided as a string value, "" otherwise.
func (r *Rule) ExplicitName() string {
return r.AttrString("name")
}
// Name returns the rule's target name.
// If the rule has no explicit target name, Name returns the implicit name if there is one, else the empty string.
func (r *Rule) Name() string {
explicitName := r.AttrString("name")
if explicitName == "" {
explicitName := r.ExplicitName()
if explicitName == "" && r.Kind() != "package" {
return r.ImplicitName
}
return explicitName
@@ -182,26 +203,25 @@ func (r *Rule) Name() string {
func (r *Rule) AttrKeys() []string {
var keys []string
for _, expr := range r.Call.List {
if binExpr, ok := expr.(*BinaryExpr); ok && binExpr.Op == "=" {
if keyExpr, ok := binExpr.X.(*LiteralExpr); ok {
keys = append(keys, keyExpr.Token)
if as, ok := expr.(*AssignExpr); ok {
if keyExpr, ok := as.LHS.(*Ident); ok {
keys = append(keys, keyExpr.Name)
}
}
}
return keys
}
// AttrDefn returns the BinaryExpr defining the rule's attribute with the given key.
// That is, the result is a *BinaryExpr with Op == "=".
// AttrDefn returns the AssignExpr defining the rule's attribute with the given key.
// If the rule has no such attribute, AttrDefn returns nil.
func (r *Rule) AttrDefn(key string) *BinaryExpr {
func (r *Rule) AttrDefn(key string) *AssignExpr {
for _, kv := range r.Call.List {
as, ok := kv.(*BinaryExpr)
if !ok || as.Op != "=" {
as, ok := kv.(*AssignExpr)
if !ok {
continue
}
k, ok := as.X.(*LiteralExpr)
if !ok || k.Token != key {
k, ok := as.LHS.(*Ident)
if !ok || k.Name != key {
continue
}
return as
@@ -217,7 +237,7 @@ func (r *Rule) Attr(key string) Expr {
if as == nil {
return nil
}
return as.Y
return as.RHS
}
// DelAttr deletes the rule's attribute with the named key.
@@ -225,17 +245,17 @@ func (r *Rule) Attr(key string) Expr {
func (r *Rule) DelAttr(key string) Expr {
list := r.Call.List
for i, kv := range list {
as, ok := kv.(*BinaryExpr)
if !ok || as.Op != "=" {
as, ok := kv.(*AssignExpr)
if !ok {
continue
}
k, ok := as.X.(*LiteralExpr)
if !ok || k.Token != key {
k, ok := as.LHS.(*Ident)
if !ok || k.Name != key {
continue
}
copy(list[i:], list[i+1:])
r.Call.List = list[:len(list)-1]
return as.Y
return as.RHS
}
return nil
}
@@ -246,15 +266,15 @@ func (r *Rule) DelAttr(key string) Expr {
func (r *Rule) SetAttr(key string, val Expr) {
as := r.AttrDefn(key)
if as != nil {
as.Y = val
as.RHS = val
return
}
r.Call.List = append(r.Call.List,
&BinaryExpr{
X: &LiteralExpr{Token: key},
Op: "=",
Y: val,
&AssignExpr{
LHS: &Ident{Name: key},
Op: "=",
RHS: val,
},
)
}
@@ -265,11 +285,14 @@ func (r *Rule) SetAttr(key string, val Expr) {
// If the rule has no such attribute or the attribute is not an identifier or number,
// AttrLiteral returns "".
func (r *Rule) AttrLiteral(key string) string {
lit, ok := r.Attr(key).(*LiteralExpr)
if !ok {
return ""
value := r.Attr(key)
if ident, ok := value.(*Ident); ok {
return ident.Name
}
return lit.Token
if literal, ok := value.(*LiteralExpr); ok {
return literal.Token
}
return ""
}
// AttrString returns the value of the rule's attribute

Some files were not shown because too many files have changed in this diff Show More