Skip to content

docs: Update CONTRIBUTING.md to clarify documentation requirements for exported types #3693

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ file.

## Code Comments

Every exported method needs to have code comments that follow
Every exported method and type needs to have code comments that follow
[Go Doc Comments][]. A typical method's comments will look like this:

```go
Expand All @@ -102,9 +102,20 @@ Every exported method needs to have code comments that follow
//
//meta:operation GET /repos/{owner}/{repo}
func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Repository, *Response, error) {
u := fmt.Sprintf("repos/%v/%v", owner, repo)
req, err := s.client.NewRequest("GET", u, nil)
...
u := fmt.Sprintf("repos/%v/%v", owner, repo)
req, err := s.client.NewRequest("GET", u, nil)
...
}
```
And the returned type `Repository` will have comments like this:
Copy link
Preview

Copilot AI Aug 20, 2025

Choose a reason for hiding this comment

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

The phrase 'returned type' is misleading since Repository may not necessarily be a return type in all contexts. Consider using 'exported type' instead to be more accurate and consistent with the updated guideline.

Suggested change
And the returned type `Repository` will have comments like this:
And the exported type `Repository` will have comments like this:

Copilot uses AI. Check for mistakes.


```go
// Repository represents a GitHub repository.
type Repository struct {
ID *int64 `json:"id,omitempty"`
NodeID *string `json:"node_id,omitempty"`
Owner *User `json:"owner,omitempty"`
...
}
```

Expand Down