Standard library / go/build/constraint

go/build/constraint.IsGoBuild()

Recognizes the modern directive prefix without validating the expression. Expected stdout: 'true false\n'.

Formal Syntax & Structure

go syntaxgo
func IsGoBuild(line string) bool

Parameters & Attributes

NameTypeDescription
linestringInput to the operation as described above.

Return Value

bool

Recognizes the modern directive prefix without validating the expression.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/build/constraint")
func main() {  fmt.Println(constraint.IsGoBuild("//go:build ("), constraint.IsGoBuild("// +build linux"))}
Go Reference