Skip to content

Fix godoc for re-exported blocks of comments#264

Open
ccoVeille wants to merge 1 commit intoyaml:mainfrom
ccoVeille:fix-godoc-block
Open

Fix godoc for re-exported blocks of comments#264
ccoVeille wants to merge 1 commit intoyaml:mainfrom
ccoVeille:fix-godoc-block

Conversation

@ccoVeille
Copy link
Contributor

When re-exporting a block of comments, we added a comment just before the block to indicate that the block is re-exported.

But the godoc will be rendered as being the comment for the next declaration, so the godoc of the first declaration.

This leads to confusion when reading the documentation of the package. The "re-exported comment" shouldn't be visible in the publicly.

Copilot AI review requested due to automatic review settings January 19, 2026 20:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes godoc rendering for re-exported type and constant blocks by adding blank lines after organizational comments. Previously, comments like "// Re-export stream-related types" would appear in the godoc for the first declaration in the following block, causing confusion in the public API documentation.

Changes:

  • Added blank lines after all re-export organizational comments to separate them from subsequent declarations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@ingydotnet ingydotnet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ccoVeille
Copy link
Contributor Author

I'm unsure this would be enough. As I'm removing random artifact in the documentation, but there are so much more to do to make it readable and usable by any Gopher.

The fact we re-export internal leads to have a poor documentation. I wish someone could easily see that a LoadError as an Error, Line and Co.

Also, it's not clear that a Load would return a LoadError that is a libyaml.ConstructError.

We should improve things. But the way cyclic dependencies led us to do this doesn't help.

A solution could be to us a package for errors, that can be imported then in yaml (root) and libyaml (internal), but that's not the way to do usually.

Another solution could be to add wrapper and not aliases, but it adds a cost just for improving documentation.

Maybe, I'm the only one worried about the internal being reexported and appearing with poor documentation

@ingydotnet ingydotnet force-pushed the fix-godoc-block branch 2 times, most recently from 4aa9195 to 84d315a Compare January 20, 2026 15:12
When re-exporting a block of comments, we added a comment just before
the block to indicate that the block is re-exported.

But the godoc will be rendered as being the comment for the next declaration,
so the godoc of the first declaration.

This leads to confusion when reading the documentation of the package.
The "re-exported comment" shouldn't be visible in the publicly.
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

Successfully merging this pull request may close these issues.

3 participants