diff options
| -rw-r--r-- | defererr.go | 13 | 
1 files changed, 9 insertions, 4 deletions
| diff --git a/defererr.go b/defererr.go index c835131..4ff0802 100644 --- a/defererr.go +++ b/defererr.go @@ -33,8 +33,8 @@ type functionState struct {  	deferErrorVar         *ast.Ident  } -func newFunctionState() *functionState { -	return &functionState{ +func newFunctionState() functionState { +	return functionState{  		firstErrorDeferEndPos: -1,  	}  } @@ -103,7 +103,7 @@ func checkFunctions(pass *analysis.Pass, node ast.Node) {  				pass,  				funcDecl.Body,  				errorReturnField, -				fState, +				&fState,  			)  			// Stop if the `defer` closure does not assign to an error @@ -112,7 +112,12 @@ func checkFunctions(pass *analysis.Pass, node ast.Node) {  				return true  			} -			checkFunctionReturns(pass, funcDecl.Body, errorReturnIndex, fState) +			checkFunctionReturns( +				pass, +				funcDecl.Body, +				errorReturnIndex, +				&fState, +			)  			return true  		}, | 
