Closed
Description
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.
Metadata
Metadata
Assignees
Type
Projects
Relationships
Development
No branches or pull requests
Activity
mdempsky commentedon Mar 9, 2016
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.)
alandonovan commentedon Mar 9, 2016
It only sort of depends on #10324. I'd be happy with file:line information if that's all that's available.
griesemer commentedon May 11, 2016
The encoding is now present, we just need to hook it up. There's a pending CL https://go-review.googlesource.com/#/c/22936/ .
adonovan commentedon May 11, 2016
See Issue #15651 for the proposed corresponding API change.
rsc commentedon Sep 26, 2016
What is the status here? Is this important for Go 1.8?
griesemer commentedon Sep 26, 2016
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.
alandonovan commentedon Sep 27, 2016
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.