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 struct {
// contains filtered or unexported fields
}
Labeler generates Bazel labels for rules, based on their locations within the repository.
func NewLabeler ¶ added in v0.5.4
func (*Labeler) BinaryLabel ¶ added in v0.5.4
func (*Labeler) GoProtoLabel ¶ added in v0.6.0
func (*Labeler) LibraryLabel ¶ added in v0.5.4
func (*Labeler) ProtoLabel ¶ added in v0.6.0
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.
func NewResolver ¶ added in v0.5.4
func (*Resolver) ResolveRule ¶ added in v0.7.1
ResolveRule copies and modifies a generated rule e by replacing the import paths in the "_gazelle_imports" attribute with labels in a "deps" attribute. This may be safely called on expressions that aren't Go rules (the original expression will be returned). Any existing "deps" attribute is deleted, so it may be necessary to merge the result.
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. |