Documentation ¶
Overview ¶
Package label provides utilities for parsing and manipulating Bazel labels. See https://docs.bazel.build/versions/master/build-ref.html#labels for more information.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var NoLabel = Label{}
NoLabel is the zero 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
Types ¶
type Label ¶
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. If omitted, Name // is assumed to be the same as Pkg. 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 }
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.
func Parse ¶
Parse reads a label from a string. See https://docs.bazel.build/versions/master/build-ref.html#lexi.
func (Label) Abs ¶
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 (Label) Contains ¶
Contains returns whether other is contained by the package of l or a sub-package. Neither label may be relative.
func (Label) Equal ¶
Equal returns whether two labels are exactly the same. It does not return true for different labels that refer to the same target.