NoLabel is the zero value of Label. It is not a valid label and may be returned when an error occurs.
var NoLabel = Label{}
func ImportPathToBazelRepoName(importpath string) string
ImportPathToBazelRepoName converts a Go import path into a bazel repo name following the guidelines in http://bazel.io/docs/be/functions.html#workspace
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 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. Name must not be empty. // Note that the name may be omitted from a label string if it is equal to // the last component of the package name ("//x" is equivalent to "//x:x"), // but in either case, Name should be set here. 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 }
func New(repo, pkg, name string) Label
New constructs a new label from components.
func Parse(s string) (Label, error)
Parse reads a label from a string. See https://docs.bazel.build/versions/master/build-ref.html#lexi.
func (l Label) Abs(repo, pkg string) Label
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) BzlExpr() bzl.Expr
func (l Label) Contains(other Label) bool
Contains returns whether other is contained by the package of l or a sub-package. Neither label may be relative.
func (l Label) Equal(other Label) bool
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) Rel(repo, pkg string) Label
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) String() string