From 1c962f3bc32a23c6302840ec187613b1749f3d03 Mon Sep 17 00:00:00 2001 From: zyfy29 Date: Wed, 20 Aug 2025 15:46:03 +0900 Subject: [PATCH] docs: Update CONTRIBUTING.md to clarify documentation requirements for exported types --- CONTRIBUTING.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 31f1f64c824..d22024657f1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 @@ -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: + +```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"` + ... } ```