-
Notifications
You must be signed in to change notification settings - Fork 18k
go/importer: encode file:line:col information for each object #14738
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
Comments
This sort of depends on #10324. (Namely, currently cmd/compile only tracks line position within a file; it does not track character position within a line.) |
It only sort of depends on #10324. I'd be happy with file:line information if that's all that's available. |
The encoding is now present, we just need to hook it up. There's a pending CL https://go-review.googlesource.com/#/c/22936/ . |
See Issue #15651 for the proposed corresponding API change. |
What is the status here? Is this important for Go 1.8? |
We have the code but it requires yet another revision of the go/importer API (we need to provide a fileset so that the positions can be created). It's related to the above-mentioned issue. We haven't done a good job with that API despite the fact that it's used in a couple of places. I'm reluctant to rush it. The main issue for us is that we need to maintain an x/tools version of the importer which provides some of the functionality missing here. |
The compiler (and go/types) now encode positions in the export data file, and the golang.org/x/tools/go/gcimporter15 API decodes and exposes them, so we can close this issue. Issue #15651 proposes a new API for the standard go/importer package, but I no longer believe importers belong in the standard library. |
Since we're redesigning the export data format, it would be great if we could include position information for all identifiers. Obviously the decoder won't be able to expose this information through the types.Object API since it doesn't have access to a FileSet, but it could provide it out-of-band via a map[Object]string or somesuch.
The text was updated successfully, but these errors were encountered: