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/importer: encode file:line:col information for each object #14738

Closed
alandonovan opened this issue Mar 9, 2016 · 7 comments
Closed

go/importer: encode file:line:col information for each object #14738

alandonovan opened this issue Mar 9, 2016 · 7 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@alandonovan
Copy link
Contributor

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.

@mdempsky
Copy link
Member

mdempsky commented 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
Copy link
Contributor Author

It only sort of depends on #10324. I'd be happy with file:line information if that's all that's available.

@bradfitz bradfitz added this to the Go1.7 milestone Apr 10, 2016
@griesemer
Copy link
Contributor

The encoding is now present, we just need to hook it up. There's a pending CL https://go-review.googlesource.com/#/c/22936/ .

@griesemer griesemer modified the milestones: Go1.8Early, Go1.7 May 11, 2016
@adonovan
Copy link
Member

adonovan commented May 11, 2016

See Issue #15651 for the proposed corresponding API change.

@rsc
Copy link
Contributor

rsc commented Sep 26, 2016

What is the status here? Is this important for Go 1.8?

@rsc rsc added the NeedsFix The path to resolution is known, but the work has not been done. label Sep 26, 2016
@griesemer
Copy link
Contributor

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
Copy link
Contributor Author

alandonovan commented 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.

@golang golang locked and limited conversation to collaborators Sep 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

7 participants