Navigation Menu

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
Milestone

Comments

@josharian
Copy link
Contributor

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

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

@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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants