Skip to content
New issue

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? Sign in to your account

go/build: missing Position information for go:embed patterns #43632

Closed
bcmills opened this issue Jan 11, 2021 · 3 comments
Closed

go/build: missing Position information for go:embed patterns #43632

bcmills opened this issue Jan 11, 2021 · 3 comments

Comments

@bcmills
Copy link
Member

@bcmills bcmills commented Jan 11, 2021

Go 1.16 adds support for go:embed patterns in source files (#41191), which are parsed and reported by the go/build package in the {,Test,XTest}EmbedPatterns fields of the build.Package struct as of CL 243941.

Much like imports, embed patterns can introduce errors in the build due to missing inputs — in this case, missing embedded files. Those errors need to be attributed back to source file positions.

For imports, the build.Package struct represents the file and line information as token.Position values in the {,Test,XTest}ImportPos fields. However, the corresponding information for embed patterns seems not to be present.

This came to my attention via CL 280452.

@bcmills
Copy link
Member Author

@bcmills bcmills commented Jan 11, 2021

Marking as release-blocker for Go 1.16 because it impacts go:embed API changes for 1.16 (#43407; CC @golang/release, @rsc).

However, we could perhaps decide to ship the go/build API changes as-is and follow up with fields for the missing position information in a subsequent release, in which case this issue should be re-milestoned.

@gopherbot
Copy link

@gopherbot gopherbot commented Jan 13, 2021

Change https://golang.org/cl/283638 mentions this issue: cmd/go/internal/load: report positions for embed errors

@gopherbot
Copy link

@gopherbot gopherbot commented Jan 13, 2021

Change https://golang.org/cl/283636 mentions this issue: go/build: report positions for go:embed directives

gopherbot pushed a commit that referenced this issue Jan 14, 2021
For #43469
For #43632

Change-Id: I9ac2da690344935da0e1dbe00b134dfcee65ec8a
Reviewed-on: https://go-review.googlesource.com/c/go/+/283636
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
@gopherbot gopherbot closed this in 9135795 Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
@bcmills @gopherbot and others
You can’t perform that action at this time.