Standard library / go/build/constraint

go/build/constraint.NotExpr.Eval()

Evaluates this logical negation against a predicate indicating active tags. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (x *NotExpr) Eval(ok func(tag string) bool) bool

Parameters & Attributes

NameTypeDescription
okfunc(tag string) boolInput to the operation as described above.

Return Value

bool

Evaluates this logical negation against a predicate indicating active tags.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/build/constraint")
func main() {  x := &constraint.NotExpr{X: &constraint.TagExpr{Tag: "windows"}}  fmt.Println(x.Eval(func(t string) bool { return t == "linux" }))}
Go Reference