github.com/wolfd/bazel-gazelle@v0.14.0/internal/config/constants.go (about)

     1  /* Copyright 2017 The Bazel Authors. All rights reserved.
     2  
     3  Licensed under the Apache License, Version 2.0 (the "License");
     4  you may not use this file except in compliance with the License.
     5  You may obtain a copy of the License at
     6  
     7     http://www.apache.org/licenses/LICENSE-2.0
     8  
     9  Unless required by applicable law or agreed to in writing, software
    10  distributed under the License is distributed on an "AS IS" BASIS,
    11  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  See the License for the specific language governing permissions and
    13  limitations under the License.
    14  */
    15  
    16  package config
    17  
    18  const (
    19  	// RulesGoRepoName is the canonical name of the rules_go repository. It must
    20  	// match the workspace name in WORKSPACE.
    21  	RulesGoRepoName = "io_bazel_rules_go"
    22  	// DefaultLibName is the name of the default go_library rule in a Go
    23  	// package directory. It must be consistent to DEFAULT_LIB in go/private/common.bf.
    24  	DefaultLibName = "go_default_library"
    25  	// DefaultTestName is a name of an internal test corresponding to
    26  	// DefaultLibName. It does not need to be consistent to something but it
    27  	// just needs to be unique in the Bazel package
    28  	DefaultTestName = "go_default_test"
    29  	// DefaultXTestName is a name of an external test corresponding to
    30  	// DefaultLibName.
    31  	DefaultXTestName = "go_default_xtest"
    32  	// DefaultProtosName is the name of a filegroup created
    33  	// whenever the library contains .pb.go files
    34  	DefaultProtosName = "go_default_library_protos"
    35  	// DefaultCgoLibName is the name of the default cgo_library rule in a Go package directory.
    36  	DefaultCgoLibName = "cgo_default_library"
    37  
    38  	// GrpcCompilerLabel is the label for the gRPC compiler plugin, used in the
    39  	// "compilers" attribute of go_proto_library rules.
    40  	GrpcCompilerLabel = "@io_bazel_rules_go//proto:go_grpc"
    41  
    42  	// GazelleImportsKey is an internal attribute that lists imported packages
    43  	// on generated rules. It is replaced with "deps" during import resolution.
    44  	GazelleImportsKey = "_gazelle_imports"
    45  )
    46  
    47  // Language is the name of a programming langauge that Gazelle knows about.
    48  // This is used to specify import paths.
    49  type Language int
    50  
    51  const (
    52  	// GoLang marks Go targets.
    53  	GoLang Language = iota
    54  
    55  	// ProtoLang marks protocol buffer targets.
    56  	ProtoLang
    57  )
    58  
    59  func (l Language) String() string {
    60  	switch l {
    61  	case GoLang:
    62  		return "go"
    63  	case ProtoLang:
    64  		return "proto"
    65  	default:
    66  		return "unknown"
    67  	}
    68  }