File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff 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// }()
You can’t perform that action at this time.
0 commit comments