Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var NoLabel = Label{}
NoLabel is the nil value of Label. It is not a valid label and may be returned when an error occurs.
Functions ¶
func ImportPathToBazelRepoName ¶
ImportPathToBazelRepoName converts a Go import path into a bazel repo name following the guidelines in http://bazel.io/docs/be/functions.html#workspace
func IsStandard ¶ added in v0.7.0
IsStandard returns whether a package is in the standard library.
Types ¶
type Label ¶
A Label represents a label of a build target in Bazel.
func ParseLabel ¶ added in v0.7.1
ParseLabel reads a label from a string. See https://docs.bazel.build/versions/master/build-ref.html#lexi.
type Labeler ¶ added in v0.5.4
type Labeler interface { LibraryLabel(rel string) Label TestLabel(rel string, isXTest bool) Label BinaryLabel(rel string) Label ProtoLabel(rel, name string) Label GoProtoLabel(rel, name string) Label }
Labeler generates Bazel labels for rules, based on their locations within the repository.
func NewLabeler ¶ added in v0.5.4
type Resolver ¶ added in v0.5.4
type Resolver struct {
// contains filtered or unexported fields
}
Resolver resolves import strings in source files (import paths in Go, import statements in protos) into Bazel labels. TODO(#859): imports are currently resolved by guessing a label based on the name. We should be smarter about this and build a table mapping import paths to labels that we can use to cross-reference.
func (*Resolver) ResolveRule ¶ added in v0.7.1
ResolveRule modifies a generated rule e by replacing the import paths in the "_gazelle_imports" attribute with labels in a "deps" attribute. This may may safely called on expressions that aren't Go rules (nothing will happen).
type RuleIndex ¶ added in v0.7.1
type RuleIndex struct {
// contains filtered or unexported fields
}
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.
func NewRuleIndex ¶ added in v0.7.1
func NewRuleIndex() *RuleIndex
func (*RuleIndex) AddGeneratedRules ¶ added in v0.7.1
AddGeneratedRules adds newly generated rules to the index. These may replace existing rules with the same label.
func (*RuleIndex) AddRulesFromFile ¶ added in v0.7.1
AddRulesFromFile adds existing rules to the index from oldFile (which must not be nil).
func (*RuleIndex) Finish ¶ added in v0.7.1
func (ix *RuleIndex) Finish()
Finish constructs the import index and performs any other necessary indexing actions after all rules have been added. This step is necessary because a rule may be indexed differently based on what rules are added later.
This function must be called after all AddRulesFromFile and AddGeneratedRules calls but before any findRuleByImport calls.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
internal
|
|
gen_std_package_list
gen_std_package_list reads a text file containing a list of packages (one per line) and generates a .go file containing a set of package names.
|
gen_std_package_list reads a text file containing a list of packages (one per line) and generates a .go file containing a set of package names. |