Golint and unexported types

Not sure I understand why golint complaints about an unexported identifier that is returned by an exported function. Is this idiomatic go ?

Golint warning :
exported %s %s returns unexported type %s, which can be annoying to use

Do you expect other packages to use this type, its methods, fields? If yes, it should be exported.

Otherwise why do you return it? Godoc doesn’t display unexported types. How would a user use it?

Thanks for the feedback,

Good point about godoc.

The users will be using couple of exported methods, not the struct fields (those are hidden).
I was looking for the “why” it should be exported , maybe godoc is the answer.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.