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/doc: confusing types displayed for mixed exported/unexported consts #9431

Open
josharian opened this issue Dec 23, 2014 · 3 comments
Open

go/doc: confusing types displayed for mixed exported/unexported consts #9431

josharian opened this issue Dec 23, 2014 · 3 comments
Milestone

Comments

@josharian
Copy link
Contributor

@josharian josharian commented Dec 23, 2014

Given:

const (
    a, _, c = T, iota, int
    D, E, f

    J, k = iota, T
    L, M
)

godoc outputs:

const (
    _ = T, iota, int
    D, E

    J = iota, T
    L, M
)

It is not clear from the output what the type of D, E, L, or M is.

I came across this while working on a follow-up to #5397. This is an edge case, and I've not seen it in the real world. It is not clear what the correct thing to do here is; probably we should just ignore it.

@griesemer
Copy link
Contributor

@griesemer griesemer commented Dec 30, 2014

One could probably come up with some heuristics to make this work, but it's not clear it's worth the effort.

The correct approach would be to use go/types to compute the correct export information, combine that with the comments present in the source, and produce a synthetic AST from that.

I would ignore this.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@agnivade
Copy link
Contributor

@agnivade agnivade commented Apr 29, 2018

Using go version devel +7a14f55 Sun Apr 29 16:14:16 2018, this is what it prints now

const (
    D, E, _

    J, _ = iota, T
    L, M
)

Not much improvement for D, E. But I think L and M are kinda clear now.

@griesemer
Copy link
Contributor

@griesemer griesemer commented Apr 30, 2018

@agnivade It's probably a mistake to not show the expressions in the first line - it would be nice if they were moved along. As is, these constants (D, E, _) look pretty lost.

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
4 participants
You can’t perform that action at this time.