diff options
| -rw-r--r-- | defererr.go | 16 | 
1 files changed, 10 insertions, 6 deletions
| diff --git a/defererr.go b/defererr.go index 77a872d..13008a2 100644 --- a/defererr.go +++ b/defererr.go @@ -199,19 +199,23 @@ func checkErrorAssignedInDefer(  					continue  				} +				// TODO: Figure out why doesDeclareErrInSignature doesn't +				// continue past here. +				fmt.Printf("variable: %#v\n", ident) +				fmt.Printf("variable.obj: %#v\n", ident.Obj) +				fmt.Printf("variable.obj.type: %#v\n", ident.Obj.Type) +				fmt.Printf("variable.obj.decl: %#v\n", ident.Obj.Decl) +  				obj := pass.TypesInfo.Defs[ident] +				fmt.Printf("obj: %#v\n", obj)  				valueSpec, ok := ident.Obj.Decl.(*ast.ValueSpec)  				if !ok {  					continue  				} -				fmt.Printf("variable: %#v\n", ident) -				fmt.Printf("variable.obj: %#v\n", ident.Obj) -				fmt.Printf("variable.obj.type: %#v\n", ident.Obj.Type)  				fmt.Printf("variable.obj.valuespec: %#v\n", valueSpec)  				fmt.Printf("variable.obj.valuespec.type: %#v\n", valueSpec.Type) -				fmt.Printf("obj: %#v\n", obj)  				t := pass.TypesInfo.Types[variable]  				fmt.Printf("type: %#v\n", t) @@ -243,8 +247,6 @@ func checkErrorAssignedInDefer(  						}  					} -					fState.setFirstErrorDeferEndPos(deferFuncLit.Body.Rbrace) -  					// Maybe don't report the error if it was declared in the closure using a GenDecl? -> We already don't. Should test for these things.  					if !isErrorNameInReturnSignature { @@ -265,6 +267,8 @@ func checkErrorAssignedInDefer(  				return true  			} +			fState.setFirstErrorDeferEndPos(deferFuncLit.Body.Rbrace) +  			// TODO: Check that funcDecl declares error in signature (check before ast.Inspect on function body, report here)  			// isErrorNameInReturnSignature := false | 
