{"action":"opened","issue":{"url":"https://api.github.com/repos/golang/go/issues/14494","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/14494/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/14494/comments","events_url":"https://api.github.com/repos/golang/go/issues/14494/events","html_url":"https://github.com/golang/go/issues/14494","id":136155813,"number":14494,"title":"cmd/vet: shadowed variables check doesn't catch shadowing from short assignment in if statements","user":{"login":"stevekuznetsov","id":7328370,"avatar_url":"https://avatars.githubusercontent.com/u/7328370?v=3","gravatar_id":"","url":"https://api.github.com/users/stevekuznetsov","html_url":"https://github.com/stevekuznetsov","followers_url":"https://api.github.com/users/stevekuznetsov/followers","following_url":"https://api.github.com/users/stevekuznetsov/following{/other_user}","gists_url":"https://api.github.com/users/stevekuznetsov/gists{/gist_id}","starred_url":"https://api.github.com/users/stevekuznetsov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevekuznetsov/subscriptions","organizations_url":"https://api.github.com/users/stevekuznetsov/orgs","repos_url":"https://api.github.com/users/stevekuznetsov/repos","events_url":"https://api.github.com/users/stevekuznetsov/events{/privacy}","received_events_url":"https://api.github.com/users/stevekuznetsov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-24T19:04:28Z","updated_at":"2016-02-24T19:04:28Z","closed_at":null,"body":"For the following example:\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"encoding/json\"\r\n\t\"io/ioutil\"\r\n\t\"log\"\r\n\t\"os\"\r\n)\r\n\r\nfunc main() {\r\n\tif len(os.Args) != 2 {\r\n\t\tlog.Fatal(\"Usage: jsonformat.go <filename>\")\r\n\t}\r\n\r\n\tbyt, err := ioutil.ReadFile(os.Args[1])\r\n\tif err != nil {\r\n\t\tlog.Fatalf(\"ERROR: Unable to read file %q: %v\\n\", os.Args[1], err)\r\n\t}\r\n\r\n\tvar dat map[string]interface{}\r\n\r\n\tif err := json.Unmarshal(byt, &dat); err != nil { // this err is not flagged as masking the err in the outer scope, incorrectly\r\n\t\tlog.Fatalf(\"ERROR: Invalid JSON file  '%v': %v\\n\", os.Args[1], err)\r\n\t}\r\n\r\n\tif output, err := json.MarshalIndent(dat, \"\", \"  \"); err != nil { // this err is flagged as masking the err in the outer scope, correctly\r\n\t\tlog.Fatalf(\"ERROR: Unable to indent JSON file: %v\\n\", os.Args[1])\r\n\t} else {\r\n\t\tos.Stdout.Write(append(output, '\\n'))\r\n\t}\r\n}\r\n```\r\n\r\nOne the errors is not flagged correctly, even when using `-shadowstrict`. My version of `go tool vet` is at `108746816ddf01ad0c2dbea08a1baef08bc47313`"}}