{"action":"opened","issue":{"url":"https://api.github.com/repos/golang/go/issues/26659","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/26659/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/26659/comments","events_url":"https://api.github.com/repos/golang/go/issues/26659/events","html_url":"https://github.com/golang/go/issues/26659","id":345447143,"node_id":"MDU6SXNzdWUzNDU0NDcxNDM=","number":26659,"title":"function assignment syntax","user":{"login":"yesuu","id":3540522,"node_id":"MDQ6VXNlcjM1NDA1MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/3540522?v=4","gravatar_id":"","url":"https://api.github.com/users/yesuu","html_url":"https://github.com/yesuu","followers_url":"https://api.github.com/users/yesuu/followers","following_url":"https://api.github.com/users/yesuu/following{/other_user}","gists_url":"https://api.github.com/users/yesuu/gists{/gist_id}","starred_url":"https://api.github.com/users/yesuu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yesuu/subscriptions","organizations_url":"https://api.github.com/users/yesuu/orgs","repos_url":"https://api.github.com/users/yesuu/repos","events_url":"https://api.github.com/users/yesuu/events{/privacy}","received_events_url":"https://api.github.com/users/yesuu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-28T13:06:48Z","updated_at":"2018-07-28T13:06:48Z","closed_at":null,"author_association":"NONE","body":"I want rename the function:\r\n\r\n```\r\nfunc sum(x, y int) int { return x + y }\r\nvar myfunc = sum\r\n```\r\n\r\nif we can change `var` to `func`:\r\n\r\n```\r\nfunc sum(x, y int) int { return x + y }\r\nfunc myfunc = sum // or: func myfunc sum ?\r\n```\r\n\r\ndon't use type derivation:\r\n\r\n```\r\nfunc sum(x, y int) int { return x + y }\r\nfunc myfunc(x, y int) int = sum // or: func myfunc(int,int) int = sum ?\r\n// var myfunc func(int,int) int = sum\r\n```\r\n\r\nthe right is a method:\r\n\r\n```\r\ntype mytype struct{}\r\nfunc (_ mytype) sum(x, y int) int { return x + y }\r\nvar myobject = new(mytype)\r\nfunc myfunc = myobject.sum\r\n// var myfunc = myobject.sum\r\n```\r\n\r\nif the left is a method, I don't know what it should be.\r\n\r\nThe difference is that the `var` syntax can assign multiple times, and `func` can only assign once."}}
{"actor":{"display_login":"yesuu"}}