{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/20802","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/20802/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/20802/comments","events_url":"https://api.github.com/repos/golang/go/issues/20802/events","html_url":"https://github.com/golang/go/issues/20802","id":238632243,"number":20802,"title":"proposal: spec: consider more strict \"declared and not used\" check (go/vet or even spec)","user":{"login":"griesemer","id":8528975,"avatar_url":"https://avatars2.githubusercontent.com/u/8528975?v=4","gravatar_id":"","url":"https://api.github.com/users/griesemer","html_url":"https://github.com/griesemer","followers_url":"https://api.github.com/users/griesemer/followers","following_url":"https://api.github.com/users/griesemer/following{/other_user}","gists_url":"https://api.github.com/users/griesemer/gists{/gist_id}","starred_url":"https://api.github.com/users/griesemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/griesemer/subscriptions","organizations_url":"https://api.github.com/users/griesemer/orgs","repos_url":"https://api.github.com/users/griesemer/repos","events_url":"https://api.github.com/users/griesemer/events{/privacy}","received_events_url":"https://api.github.com/users/griesemer/received_events","type":"User","site_admin":false},"labels":[{"id":150880249,"url":"https://api.github.com/repos/golang/go/labels/Go2","name":"Go2","color":"ffaaaa","default":false},{"id":236419512,"url":"https://api.github.com/repos/golang/go/labels/Proposal","name":"Proposal","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/30","html_url":"https://github.com/golang/go/milestone/30","labels_url":"https://api.github.com/repos/golang/go/milestones/30/labels","id":1373555,"number":30,"title":"Proposal","description":"Proposals that are pending (not yet accepted/rejected).\r\n","creator":{"login":"rsc","id":104030,"avatar_url":"https://avatars1.githubusercontent.com/u/104030?v=4","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"open_issues":228,"closed_issues":369,"state":"open","created_at":"2015-10-24T01:40:49Z","updated_at":"2018-02-20T22:18:37Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2017-06-26T18:37:57Z","updated_at":"2018-02-20T22:24:48Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"The following code\r\n```\r\nfunc f(i interface{}) *T {\r\n\tx, ok := i.(*T)\r\n\tif !ok {\r\n\t\tx := new(T)\r\n\t\tx.f = 0\r\n\t}\r\n\treturn x\r\n}\r\n```\r\ncompiles without errors even though it is obviously incorrect: Inside the block of the `if` statement, the `:=` operator should have been `=` instead. The compiler doesn't complain because the assignment to `x.f` counts as _use_ of `x`.\r\n\r\nArguably, assignments to fields/elements of composite type variables shouldn't be counted as _uses_. Their effect is lost if the variable itself is never used and they may hide the fact that the variable is not used.\r\n\r\n(This was the underlying cause for #20789.)\r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/367142004","html_url":"https://github.com/golang/go/issues/20802#issuecomment-367142004","issue_url":"https://api.github.com/repos/golang/go/issues/20802","id":367142004,"user":{"login":"ianlancetaylor","id":3194333,"avatar_url":"https://avatars2.githubusercontent.com/u/3194333?v=4","gravatar_id":"","url":"https://api.github.com/users/ianlancetaylor","html_url":"https://github.com/ianlancetaylor","followers_url":"https://api.github.com/users/ianlancetaylor/followers","following_url":"https://api.github.com/users/ianlancetaylor/following{/other_user}","gists_url":"https://api.github.com/users/ianlancetaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/ianlancetaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianlancetaylor/subscriptions","organizations_url":"https://api.github.com/users/ianlancetaylor/orgs","repos_url":"https://api.github.com/users/ianlancetaylor/repos","events_url":"https://api.github.com/users/ianlancetaylor/events{/privacy}","received_events_url":"https://api.github.com/users/ianlancetaylor/received_events","type":"User","site_admin":false},"created_at":"2018-02-20T22:24:48Z","updated_at":"2018-02-20T22:24:48Z","author_association":"CONTRIBUTOR","body":"We can't detect all possible bugs, but if we only count `x.f = 1` as an assignment and don't count `x.f1.f2 = 1` as one, perhaps we can at least do that."}}
{"actor":{"display_login":"ianlancetaylor"}}