Skip to content

x/pkgsite: show exported fields promoted from unexported anonymous fields #6600

Open
@ugorji

Description

@ugorji
Within my code, I have the following structure.

type common struct {
    Option1 bool
}

func (c *common) Method1() {
}

type A struct {
    OptionA int
    common
}

type B struct {
    OptionB int
    common
}

I want godoc to show that type A and type B have field Option1 available, and Method1 in
their method sets.

However, godoc would not show Option1, because common is not exported. It however show
Method1 (the full method set).

The only current workaround is to export common (which really is an internal
implementation detail), or duplicate the functionality across all types that share it. 

TO fix, godoc should show these promoted fields got from unexported anonymous fields. 

For example, godoc output for A could look like:

type A struct {
    OptionA int
    // contains filtered or unexported fields
    // Available from unexported anonymous fields
    Option1 bool
}


Which version are you using?  (run 'go version')
go version devel +47b2b07a837f Fri Oct 11 16:39:40 2013 -0700 linux/amd64

Please provide any additional information below.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.pkgsite

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions