Documentation ¶
Overview ¶
Package labels contains helper functions for working with labels.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Label ¶
type Label struct { Repository string // Repository of the target, can be empty if the target belongs to the current repository Package string // Package of a target, can be empty for top packages Target string // Name of the target, should be always non-empty }
Label represents a Bazel target label.
func Parse ¶
Parse parses an absolute Bazel label (eg. //devtools/buildozer:rule) and returns the corresponding Label object.
func ParseRelative ¶
ParseRelative parses a label `input` which may be absolute or relative. If it's relative then it's considered to belong to `pkg`
func (Label) Format ¶
Format returns a string representation of a label. It's always absolute but the target name is omitted if it's equal to the package directory, e.g. "//package/foo:foo" is formatted as "//package/foo".
func (Label) FormatRelative ¶
FormatRelative returns a string representation of a label relative to `pkg` (relative label if it represents a target in the same package, absolute otherwise)