package constraint

Import Path
	go/build/constraint (on golang.org and go.dev)

Dependency Relation
	imports 4 packages, and imported by 0 packages

Involved Source Files Package constraint implements parsing and evaluation of build constraint lines. See https://golang.org/cmd/go/#hdr-Build_constraints for documentation about build constraints themselves. This package parses both the original “// +build” syntax and the “//go:build” syntax that will be added in Go 1.17. The parser is being included in Go 1.16 to allow tools that need to process Go 1.17 source code to still be built against the Go 1.16 release. See https://golang.org/design/draft-gobuild for details about the “//go:build” syntax.
Package-Level Type Names (total 6)
/* sort by: | */
An AndExpr represents the expression X && Y. X Expr Y Expr (*T) Eval(ok func(tag string) bool) bool (*T) String() string *T : Expr *T : expvar.Var *T : fmt.Stringer
An Expr is a build tag constraint expression. The underlying concrete type is *AndExpr, *OrExpr, *NotExpr, or *TagExpr. Eval reports whether the expression evaluates to true. It calls ok(tag) as needed to find out whether a given build tag is satisfied by the current build configuration. String returns the string form of the expression, using the boolean syntax used in //go:build lines. *AndExpr *NotExpr *OrExpr *TagExpr T : expvar.Var T : fmt.Stringer func Parse(line string) (Expr, error) func PlusBuildLines(x Expr) ([]string, error)
A NotExpr represents the expression !X (the negation of X). X Expr (*T) Eval(ok func(tag string) bool) bool (*T) String() string *T : Expr *T : expvar.Var *T : fmt.Stringer
An OrExpr represents the expression X || Y. X Expr Y Expr (*T) Eval(ok func(tag string) bool) bool (*T) String() string *T : Expr *T : expvar.Var *T : fmt.Stringer
A SyntaxError reports a syntax error in a parsed build expression. // description of error // byte offset in input where error was detected (*T) Error() string *T : error
A TagExpr is an Expr for the single tag Tag. // for example, “linux” or “cgo” (*T) Eval(ok func(tag string) bool) bool (*T) String() string *T : Expr *T : expvar.Var *T : fmt.Stringer
Package-Level Functions (total 4)
IsGoBuild reports whether the line of text is a “//go:build” constraint. It only checks the prefix of the text, not that the expression itself parses.
IsPlusBuild reports whether the line of text is a “// +build” constraint. It only checks the prefix of the text, not that the expression itself parses.
Parse parses a single build constraint line of the form “//go:build ...” or “// +build ...” and returns the corresponding boolean expression.
PlusBuildLines returns a sequence of “// +build” lines that evaluate to the build expression x. If the expression is too complex to convert directly to “// +build” lines, PlusBuildLines returns an error.