File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,27 @@ func (int required, ...Options) {
200
200
201
201
## Error Handling
202
202
203
+ ### Prefer inline error handling
204
+
205
+ When possible, use inline error handling.
206
+
207
+ DO:
208
+
209
+ ``` go
210
+ if err := execute (); err != nil {
211
+ // handle error
212
+ }
213
+ ```
214
+
215
+ DO NOT:
216
+
217
+ ``` go
218
+ err := execute ()
219
+ if err != nil {
220
+ // handle error
221
+ }
222
+ ```
223
+
203
224
### Do not filter context when returning errors
204
225
205
226
Preserve error context by wrapping errors as the stack unwinds. Utilize native error wrapping with ` fmt.Errorf ` and
Original file line number Diff line number Diff line change 2
2
3
3
## Submitter Guidelines
4
4
5
- - Fill in [ our pull request template] ( /.github/PULL_REQUEST_TEMPLATE.md ) .
5
+ - Title the PR using customer-focused language. The release notes are generated from PR titles, so the titles should
6
+ describe the feature from the user's perspective and avoid implementation details. For example, instead of "Add debug
7
+ boolean", write "Support configurable debug mode".
8
+ - Fill in [ our pull request template] ( /.github/PULL_REQUEST_TEMPLATE.md ) .
6
9
- Make sure to include the issue number in the PR description to automatically close the issue when the PR mergers.
7
10
See [ Closing Issues via Pull Requests] ( https://github.blog/2013-05-14-closing-issues-via-pull-requests/ ) for details.
8
11
- For significant changes, break your changes into a logical series of smaller commits. By approaching the changes
You can’t perform that action at this time.
0 commit comments