Standard library / go/build
go/build.NoGoError
Represents a directory with no buildable Go source files. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
type NoGoError struct { Dir string}Working Example
Example Snippetgo
package main
import ( "errors" "fmt" "go/build" "os")
func check(e error) { if e != nil { panic(e) }}
func main() { d, e := os.MkdirTemp("", "build-error-") check(e) defer os.RemoveAll(d) _, e = build.ImportDir(d, 0) var x *build.NoGoError ok := errors.As(e, &x) fmt.Println(ok)}