Standard library / go/build/constraint

go/build/constraint.SyntaxError

Contains byte offset and error description for invalid build syntax. Expected stdout: 'true true\n'.

Formal Syntax & Structure

go syntaxgo
type SyntaxError struct {  Offset int  Err    string}

Working Example

Example Snippetgo
package main
import (  "errors"  "fmt"  "go/build/constraint")
func main() {  _, e := constraint.Parse("//go:build linux &&")  var s *constraint.SyntaxError  fmt.Println(errors.As(e, &s), s.Err != "")}
Go Reference