Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
to your account
Please answer these questions before submitting your issue. Thanks!
Atleast go 1.7 & 1.8 have this error
Can reproduce this error on Mac & Linux
I can build my program fine even if there is a file that is only supposed to compile with go 1.9 with a build constraint for example:
The ParseDir function in "go/parser" does not respect the "+build 1.9" constraint in the comment and tries to parse the file anyways causing it to throw an error.
I expected the ParseDir to ignore the file as the file has an Build Constraint which should signal ParseDir which is trying to parse all *.go" files for their AST that it cannot fully parse this file.
The ParseDir throws a mysterious error:
src/golang.org/x/net/context pkg cause error: src/golang.org/x/net/context/go19.go:15:14: expected type, found '=' (and 1 more errors)
The text was updated successfully, but these errors were encountered:
go/parser.ParseDir does not and by design must not consider build tags.
If you need to discriminate by build constraints you can use the PackageClauseOnly|ParseComments mode to handle them by yourself or you can use go/build.ImportDir.
Sorry, something went wrong.
Ignoring files with 19.go suffix to fix a bug caused by ParseDir not …
…respecting build constraints: golang/go#21157
What @cznic said - there doesn't seem to be a bug here. Its godoc even says "all files with names ending in .go".
No branches or pull requests