Standard library / go/build/constraint
go/build/constraint.TagExpr.Eval()
Evaluates this single build tag against a predicate indicating active tags. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (x *TagExpr) Eval(ok func(tag string) bool) boolParameters & Attributes
| Name | Type | Description |
|---|---|---|
| ok | func(tag string) bool | Input to the operation as described above. |
Return Value
bool
Evaluates this single build tag against a predicate indicating active tags.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/build/constraint")
func main() { x := &constraint.TagExpr{Tag: "linux"} fmt.Println(x.Eval(func(t string) bool { return t == "linux" }))}