From 60577fa083ad60cd7e5a6ef408fe4e6a4f8013e7 Mon Sep 17 00:00:00 2001 From: Kate Osborn Date: Wed, 12 Jul 2023 12:14:29 -0600 Subject: [PATCH] Update developer docs Problems: - Go style guide is missing guideline on inline error checking - Pull request guide is missing guideline on PR titles Solution: Add guidelines to relevant docs --- docs/developer/go-style-guide.md | 21 +++++++++++++++++++++ docs/developer/pull-request.md | 5 ++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/developer/go-style-guide.md b/docs/developer/go-style-guide.md index 049fb7ad0..6e004d2ce 100644 --- a/docs/developer/go-style-guide.md +++ b/docs/developer/go-style-guide.md @@ -200,6 +200,27 @@ func (int required, ...Options) { ## Error Handling +### Prefer inline error handling + +When possible, use inline error handling. + +DO: + +```go +if err := execute(); err != nil { + // handle error +} +``` + +DO NOT: + +```go +err := execute() +if err != nil { + // handle error +} +``` + ### Do not filter context when returning errors Preserve error context by wrapping errors as the stack unwinds. Utilize native error wrapping with `fmt.Errorf` and diff --git a/docs/developer/pull-request.md b/docs/developer/pull-request.md index 6fc519d02..2809c623f 100644 --- a/docs/developer/pull-request.md +++ b/docs/developer/pull-request.md @@ -2,7 +2,10 @@ ## Submitter Guidelines -- Fill in [our pull request template](/.github/PULL_REQUEST_TEMPLATE.md). +- Title the PR using customer-focused language. The release notes are generated from PR titles, so the titles should + describe the feature from the user's perspective and avoid implementation details. For example, instead of "Add debug + boolean", write "Support configurable debug mode". +- Fill in [our pull request template](/.github/PULL_REQUEST_TEMPLATE.md). - Make sure to include the issue number in the PR description to automatically close the issue when the PR mergers. See [Closing Issues via Pull Requests](https://github.blog/2013-05-14-closing-issues-via-pull-requests/) for details. - For significant changes, break your changes into a logical series of smaller commits. By approaching the changes