Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
go version go1.7.1 darwin/amd64
A sample code:
package main
import (
"fmt"
"github.com/pkg/errors"
)
func main() {
var err error
defer func() {
// Rear the mistake here is just a local error in processing logic, does not belong to the end to unified handling errors
if err := errors.New(""); err != nil {
fmt.Println(err)
}
// Business logic mistakes need to deal with here
fmt.Println(err)
}()
if err = errors.New(""); err != nil {
return
}
if err = errors.New(""); err != nil {
return
}
}
Run the command go tool vet -shadow *.go to get :
sample.go:14: declaration of "err" shadows declaration at sample.go:10
I think there is no question of such code, in the main function in the defer if caused by using the local err statement.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version)?A sample code:
Run the command
go tool vet -shadow *.goto get :I think there is no question of such code, in the main function in the defer if caused by using the local err statement.