{"action":"closed","number":46,"pull_request":{"url":"https://api.github.com/repos/godoctor/godoctor/pulls/46","id":200007126,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAwMDA3MTI2","html_url":"https://github.com/godoctor/godoctor/pull/46","diff_url":"https://github.com/godoctor/godoctor/pull/46.diff","patch_url":"https://github.com/godoctor/godoctor/pull/46.patch","issue_url":"https://api.github.com/repos/godoctor/godoctor/issues/46","number":46,"state":"closed","locked":false,"title":"Fix renaming functions","user":{"login":"birdayz","id":12021385,"node_id":"MDQ6VXNlcjEyMDIxMzg1","avatar_url":"https://avatars2.githubusercontent.com/u/12021385?v=4","gravatar_id":"","url":"https://api.github.com/users/birdayz","html_url":"https://github.com/birdayz","followers_url":"https://api.github.com/users/birdayz/followers","following_url":"https://api.github.com/users/birdayz/following{/other_user}","gists_url":"https://api.github.com/users/birdayz/gists{/gist_id}","starred_url":"https://api.github.com/users/birdayz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/birdayz/subscriptions","organizations_url":"https://api.github.com/users/birdayz/orgs","repos_url":"https://api.github.com/users/birdayz/repos","events_url":"https://api.github.com/users/birdayz/events{/privacy}","received_events_url":"https://api.github.com/users/birdayz/received_events","type":"User","site_admin":false},"body":"In my case, godoctor fails to rename functions. I don't know if this is a general problem with the current codebase, or if it's rather specific to my input file.\r\n\r\nHappens to me with this input file: https://github.com/infinimesh/mqtt-go/blob/master/cmd/example_server/main.go \r\n\r\n`[/home/j0e/gopath/bin/godoctor -w -file /home/j0e/gopath/src/github.com/infinimesh/mqtt-go/cmd/example_server/main.go -pos 943,4 rename main2]\r\nDefaulting to package scope github.com/infinimesh/mqtt-go/cmd/example_server for refactoring (provide an explicit scope to change this)\r\n../cmd/example_server/main.go:28:7: Error: Please select an identifier to rename. (Selected node: *ast.FuncDecl)\r\n`\r\nPos and len are correct as far as i saw (pos on first char of func name, and len is correct)\r\n\r\nI'm aware that renaming the main will fail with a different error as godoctor won't allow renaming the main func, but let's ignore that :)\r\n\r\nin some cases, SelectedNode is set to ast.FuncDecl instead of ast.Ident, even if\r\nthe -pos flag was given correctly. In many cases, it's not a problem as the\r\nIdent is part of the struct (e.g. for FuncDecl)\r\n\r\nMy fix just accepts the fact that rename gets passed a FuncDecl instead of the Ident. It's fine, since FuncDecl hat a member \"Name\" which is the Ident.\r\nIt feels like this is not the perfect solution. Most likely, the \"processing\" before rename - where the \"SelectedNode\" is determined, should be modified. However, as i'm not very deep into godoctor's codebase this was the most reasonable fix to apply for me. Especially since such a change might affect other modules beside rename.\r\n\r\nI'm very open to help if this approach is not correct (let me wait for test results :) ), as i'm not very much into godoctor's codebase.","created_at":"2018-07-09T06:57:18Z","updated_at":"2018-11-06T03:30:17Z","closed_at":"2018-11-06T03:30:17Z","merged_at":"2018-11-06T03:30:17Z","merge_commit_sha":"13d033d09927289fe1110804ba479ffe4276410e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/godoctor/godoctor/pulls/46/commits","review_comments_url":"https://api.github.com/repos/godoctor/godoctor/pulls/46/comments","review_comment_url":"https://api.github.com/repos/godoctor/godoctor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/godoctor/godoctor/issues/46/comments","statuses_url":"https://api.github.com/repos/godoctor/godoctor/statuses/b49bd0e2228add24682d80c27258f35630ab2aa6","head":{"label":"birdayz:funcdecl_infer_ident","ref":"funcdecl_infer_ident","sha":"b49bd0e2228add24682d80c27258f35630ab2aa6","user":{"login":"birdayz","id":12021385,"node_id":"MDQ6VXNlcjEyMDIxMzg1","avatar_url":"https://avatars2.githubusercontent.com/u/12021385?v=4","gravatar_id":"","url":"https://api.github.com/users/birdayz","html_url":"https://github.com/birdayz","followers_url":"https://api.github.com/users/birdayz/followers","following_url":"https://api.github.com/users/birdayz/following{/other_user}","gists_url":"https://api.github.com/users/birdayz/gists{/gist_id}","starred_url":"https://api.github.com/users/birdayz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/birdayz/subscriptions","organizations_url":"https://api.github.com/users/birdayz/orgs","repos_url":"https://api.github.com/users/birdayz/repos","events_url":"https://api.github.com/users/birdayz/events{/privacy}","received_events_url":"https://api.github.com/users/birdayz/received_events","type":"User","site_admin":false},"repo":{"id":140243103,"node_id":"MDEwOlJlcG9zaXRvcnkxNDAyNDMxMDM=","name":"godoctor","full_name":"birdayz/godoctor","private":false,"owner":{"login":"birdayz","id":12021385,"node_id":"MDQ6VXNlcjEyMDIxMzg1","avatar_url":"https://avatars2.githubusercontent.com/u/12021385?v=4","gravatar_id":"","url":"https://api.github.com/users/birdayz","html_url":"https://github.com/birdayz","followers_url":"https://api.github.com/users/birdayz/followers","following_url":"https://api.github.com/users/birdayz/following{/other_user}","gists_url":"https://api.github.com/users/birdayz/gists{/gist_id}","starred_url":"https://api.github.com/users/birdayz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/birdayz/subscriptions","organizations_url":"https://api.github.com/users/birdayz/orgs","repos_url":"https://api.github.com/users/birdayz/repos","events_url":"https://api.github.com/users/birdayz/events{/privacy}","received_events_url":"https://api.github.com/users/birdayz/received_events","type":"User","site_admin":false},"html_url":"https://github.com/birdayz/godoctor","description":"Go Doctor - The Golang Refactoring Engine","fork":true,"url":"https://api.github.com/repos/birdayz/godoctor","forks_url":"https://api.github.com/repos/birdayz/godoctor/forks","keys_url":"https://api.github.com/repos/birdayz/godoctor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/birdayz/godoctor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/birdayz/godoctor/teams","hooks_url":"https://api.github.com/repos/birdayz/godoctor/hooks","issue_events_url":"https://api.github.com/repos/birdayz/godoctor/issues/events{/number}","events_url":"https://api.github.com/repos/birdayz/godoctor/events","assignees_url":"https://api.github.com/repos/birdayz/godoctor/assignees{/user}","branches_url":"https://api.github.com/repos/birdayz/godoctor/branches{/branch}","tags_url":"https://api.github.com/repos/birdayz/godoctor/tags","blobs_url":"https://api.github.com/repos/birdayz/godoctor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/birdayz/godoctor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/birdayz/godoctor/git/refs{/sha}","trees_url":"https://api.github.com/repos/birdayz/godoctor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/birdayz/godoctor/statuses/{sha}","languages_url":"https://api.github.com/repos/birdayz/godoctor/languages","stargazers_url":"https://api.github.com/repos/birdayz/godoctor/stargazers","contributors_url":"https://api.github.com/repos/birdayz/godoctor/contributors","subscribers_url":"https://api.github.com/repos/birdayz/godoctor/subscribers","subscription_url":"https://api.github.com/repos/birdayz/godoctor/subscription","commits_url":"https://api.github.com/repos/birdayz/godoctor/commits{/sha}","git_commits_url":"https://api.github.com/repos/birdayz/godoctor/git/commits{/sha}","comments_url":"https://api.github.com/repos/birdayz/godoctor/comments{/number}","issue_comment_url":"https://api.github.com/repos/birdayz/godoctor/issues/comments{/number}","contents_url":"https://api.github.com/repos/birdayz/godoctor/contents/{+path}","compare_url":"https://api.github.com/repos/birdayz/godoctor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/birdayz/godoctor/merges","archive_url":"https://api.github.com/repos/birdayz/godoctor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/birdayz/godoctor/downloads","issues_url":"https://api.github.com/repos/birdayz/godoctor/issues{/number}","pulls_url":"https://api.github.com/repos/birdayz/godoctor/pulls{/number}","milestones_url":"https://api.github.com/repos/birdayz/godoctor/milestones{/number}","notifications_url":"https://api.github.com/repos/birdayz/godoctor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/birdayz/godoctor/labels{/name}","releases_url":"https://api.github.com/repos/birdayz/godoctor/releases{/id}","deployments_url":"https://api.github.com/repos/birdayz/godoctor/deployments","created_at":"2018-07-09T06:49:43Z","updated_at":"2018-07-09T06:49:45Z","pushed_at":"2018-11-05T22:25:57Z","git_url":"git://github.com/birdayz/godoctor.git","ssh_url":"git@github.com:birdayz/godoctor.git","clone_url":"https://github.com/birdayz/godoctor.git","svn_url":"https://github.com/birdayz/godoctor","homepage":null,"size":2928,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"godoctor:master","ref":"master","sha":"a60534fdf4b955fb344dec5e2e7f26122ff6a528","user":{"login":"godoctor","id":9682935,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk2ODI5MzU=","avatar_url":"https://avatars1.githubusercontent.com/u/9682935?v=4","gravatar_id":"","url":"https://api.github.com/users/godoctor","html_url":"https://github.com/godoctor","followers_url":"https://api.github.com/users/godoctor/followers","following_url":"https://api.github.com/users/godoctor/following{/other_user}","gists_url":"https://api.github.com/users/godoctor/gists{/gist_id}","starred_url":"https://api.github.com/users/godoctor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/godoctor/subscriptions","organizations_url":"https://api.github.com/users/godoctor/orgs","repos_url":"https://api.github.com/users/godoctor/repos","events_url":"https://api.github.com/users/godoctor/events{/privacy}","received_events_url":"https://api.github.com/users/godoctor/received_events","type":"Organization","site_admin":false},"repo":{"id":26505240,"node_id":"MDEwOlJlcG9zaXRvcnkyNjUwNTI0MA==","name":"godoctor","full_name":"godoctor/godoctor","private":false,"owner":{"login":"godoctor","id":9682935,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk2ODI5MzU=","avatar_url":"https://avatars1.githubusercontent.com/u/9682935?v=4","gravatar_id":"","url":"https://api.github.com/users/godoctor","html_url":"https://github.com/godoctor","followers_url":"https://api.github.com/users/godoctor/followers","following_url":"https://api.github.com/users/godoctor/following{/other_user}","gists_url":"https://api.github.com/users/godoctor/gists{/gist_id}","starred_url":"https://api.github.com/users/godoctor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/godoctor/subscriptions","organizations_url":"https://api.github.com/users/godoctor/orgs","repos_url":"https://api.github.com/users/godoctor/repos","events_url":"https://api.github.com/users/godoctor/events{/privacy}","received_events_url":"https://api.github.com/users/godoctor/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/godoctor/godoctor","description":"Go Doctor - The Golang Refactoring Engine","fork":false,"url":"https://api.github.com/repos/godoctor/godoctor","forks_url":"https://api.github.com/repos/godoctor/godoctor/forks","keys_url":"https://api.github.com/repos/godoctor/godoctor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/godoctor/godoctor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/godoctor/godoctor/teams","hooks_url":"https://api.github.com/repos/godoctor/godoctor/hooks","issue_events_url":"https://api.github.com/repos/godoctor/godoctor/issues/events{/number}","events_url":"https://api.github.com/repos/godoctor/godoctor/events","assignees_url":"https://api.github.com/repos/godoctor/godoctor/assignees{/user}","branches_url":"https://api.github.com/repos/godoctor/godoctor/branches{/branch}","tags_url":"https://api.github.com/repos/godoctor/godoctor/tags","blobs_url":"https://api.github.com/repos/godoctor/godoctor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/godoctor/godoctor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/godoctor/godoctor/git/refs{/sha}","trees_url":"https://api.github.com/repos/godoctor/godoctor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/godoctor/godoctor/statuses/{sha}","languages_url":"https://api.github.com/repos/godoctor/godoctor/languages","stargazers_url":"https://api.github.com/repos/godoctor/godoctor/stargazers","contributors_url":"https://api.github.com/repos/godoctor/godoctor/contributors","subscribers_url":"https://api.github.com/repos/godoctor/godoctor/subscribers","subscription_url":"https://api.github.com/repos/godoctor/godoctor/subscription","commits_url":"https://api.github.com/repos/godoctor/godoctor/commits{/sha}","git_commits_url":"https://api.github.com/repos/godoctor/godoctor/git/commits{/sha}","comments_url":"https://api.github.com/repos/godoctor/godoctor/comments{/number}","issue_comment_url":"https://api.github.com/repos/godoctor/godoctor/issues/comments{/number}","contents_url":"https://api.github.com/repos/godoctor/godoctor/contents/{+path}","compare_url":"https://api.github.com/repos/godoctor/godoctor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/godoctor/godoctor/merges","archive_url":"https://api.github.com/repos/godoctor/godoctor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/godoctor/godoctor/downloads","issues_url":"https://api.github.com/repos/godoctor/godoctor/issues{/number}","pulls_url":"https://api.github.com/repos/godoctor/godoctor/pulls{/number}","milestones_url":"https://api.github.com/repos/godoctor/godoctor/milestones{/number}","notifications_url":"https://api.github.com/repos/godoctor/godoctor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/godoctor/godoctor/labels{/name}","releases_url":"https://api.github.com/repos/godoctor/godoctor/releases{/id}","deployments_url":"https://api.github.com/repos/godoctor/godoctor/deployments","created_at":"2014-11-11T21:24:53Z","updated_at":"2018-11-05T21:28:16Z","pushed_at":"2018-11-06T03:30:17Z","git_url":"git://github.com/godoctor/godoctor.git","ssh_url":"git@github.com:godoctor/godoctor.git","clone_url":"https://github.com/godoctor/godoctor.git","svn_url":"https://github.com/godoctor/godoctor","homepage":null,"size":2998,"stargazers_count":292,"watchers_count":292,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":17,"open_issues":9,"watchers":292,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/godoctor/godoctor/pulls/46"},"html":{"href":"https://github.com/godoctor/godoctor/pull/46"},"issue":{"href":"https://api.github.com/repos/godoctor/godoctor/issues/46"},"comments":{"href":"https://api.github.com/repos/godoctor/godoctor/issues/46/comments"},"review_comments":{"href":"https://api.github.com/repos/godoctor/godoctor/pulls/46/comments"},"review_comment":{"href":"https://api.github.com/repos/godoctor/godoctor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/godoctor/godoctor/pulls/46/commits"},"statuses":{"href":"https://api.github.com/repos/godoctor/godoctor/statuses/b49bd0e2228add24682d80c27258f35630ab2aa6"}},"author_association":"NONE","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"rdallman","id":2935111,"node_id":"MDQ6VXNlcjI5MzUxMTE=","avatar_url":"https://avatars0.githubusercontent.com/u/2935111?v=4","gravatar_id":"","url":"https://api.github.com/users/rdallman","html_url":"https://github.com/rdallman","followers_url":"https://api.github.com/users/rdallman/followers","following_url":"https://api.github.com/users/rdallman/following{/other_user}","gists_url":"https://api.github.com/users/rdallman/gists{/gist_id}","starred_url":"https://api.github.com/users/rdallman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdallman/subscriptions","organizations_url":"https://api.github.com/users/rdallman/orgs","repos_url":"https://api.github.com/users/rdallman/repos","events_url":"https://api.github.com/users/rdallman/events{/privacy}","received_events_url":"https://api.github.com/users/rdallman/received_events","type":"User","site_admin":false},"comments":2,"review_comments":0,"maintainer_can_modify":false,"commits":2,"additions":41,"deletions":28,"changed_files":3}}
{"actor":{"display_login":"rdallman"}}