Skip to content

Commit f285e90

Browse files
Apply suggestions from code review
Co-authored-by: Jordan Schalm <[email protected]>
1 parent 522e0f3 commit f285e90

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

utils/merr/closer.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,18 @@ import (
99
// CloseAndMergeError close the closable and merge the closeErr with the given err into a multierror
1010
// Note: when using this function in a defer function, don't use as below:
1111
// func XXX() (
12-
//
1312
// err error,
1413
// ) {
15-
// def func() {
16-
// // bad, because the definition of err might get overwritten
14+
// defer func() {
15+
// // bad, because the definition of err might get overwritten by another deferred function
1716
// err = closeAndMergeError(closable, err)
1817
// }()
1918
//
2019
// Better to use as below:
2120
// func XXX() (
22-
//
2321
// errToReturn error,
2422
// ) {
25-
// def func() {
23+
// defer func() {
2624
// // good, because the error to returned is only updated here, and guaranteed to be returned
2725
// errToReturn = closeAndMergeError(closable, errToReturn)
2826
// }()

0 commit comments

Comments
 (0)