Skip to content

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

Closed
@alandonovan

Description

@alandonovan

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.

Activity

mdempsky

mdempsky commented on Mar 9, 2016

@mdempsky
Contributor

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

alandonovan commented on Mar 9, 2016

@alandonovan
ContributorAuthor

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

added this to the Go1.7 milestone on Apr 10, 2016
griesemer

griesemer commented on May 11, 2016

@griesemer
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/ .

modified the milestones: Go1.8Early, Go1.7 on May 11, 2016
adonovan

adonovan commented on May 11, 2016

@adonovan
Member

See Issue #15651 for the proposed corresponding API change.

rsc

rsc commented on Sep 26, 2016

@rsc
Contributor

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

added
NeedsFixThe path to resolution is known, but the work has not been done.
on Sep 26, 2016
griesemer

griesemer commented on Sep 26, 2016

@griesemer
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

alandonovan commented on Sep 27, 2016

@alandonovan
ContributorAuthor

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.

locked and limited conversation to collaborators on Sep 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bradfitz@mdempsky@rsc@adonovan@alandonovan

        Issue actions

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