Standard library / go/build/constraint
go/build/constraint.Expr
Interface representing a parsed build constraint; use Eval to test a specific tag set. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
type Expr interface { String() string
Eval(ok func(tag string) bool) bool
}Working Example
Example Snippetgo
package main
import ( "fmt" "go/build/constraint")
func main() { var x constraint.Expr = &constraint.TagExpr{Tag: "linux"} fmt.Println(x.Eval(func(t string) bool { return t == "linux" }))}