{"action":"created","comment":{"url":"https://api.github.com/repos/derekparker/delve/pulls/comments/53048242","id":53048242,"diff_hunk":"@@ -210,17 +211,28 @@ func traceCmd(cmd *cobra.Command, args []string) {\n \tstatus := func() int {\n \t\tconst debugname = \"debug\"\n \t\tvar processArgs []string\n+\t\tvar regexp string\n \t\tif traceAttachPid == 0 {\n-\t\t\tif err := gobuild(debugname); err != nil {\n-\t\t\t\treturn 1\n+\t\t\tvar pkg string\n+\t\t\tnargs := args\n+\t\t\tif cmd.ArgsLenAtDash() > 0 {\n+\t\t\t\tnargs = args[:cmd.ArgsLenAtDash()]\n \t\t\t}\n-\t\t\tfp, err := filepath.Abs(\"./\" + debugname)\n-\t\t\tif err != nil {\n-\t\t\t\tfmt.Fprintf(os.Stderr, err.Error())\n+\t\t\tswitch len(nargs) {\n+\t\t\tcase 1:\n+\t\t\t\tregexp = args[0]\n+\t\t\tcase 2:\n+\t\t\t\tif cmd.ArgsLenAtDash() != 1 {\n+\t\t\t\t\tpkg = args[0]\n+\t\t\t\t}\n+\t\t\t\tregexp = args[1]\n+\t\t\t}\n+\t\t\tif err := gobuild(debugname, pkg); err != nil {\n \t\t\t\treturn 1\n \t\t\t}\n-\t\t\tdefer os.Remove(fp)\n+\t\t\tdefer os.Remove(\"./\" + debugname)","path":"cmd/dlv/main.go","position":145,"original_position":145,"commit_id":"9f2487f4052c4a95558afb9905365715f631ec9e","original_commit_id":"9f2487f4052c4a95558afb9905365715f631ec9e","user":{"login":"derekparker","id":1314079,"avatar_url":"https://avatars.githubusercontent.com/u/1314079?v=3","gravatar_id":"","url":"https://api.github.com/users/derekparker","html_url":"https://github.com/derekparker","followers_url":"https://api.github.com/users/derekparker/followers","following_url":"https://api.github.com/users/derekparker/following{/other_user}","gists_url":"https://api.github.com/users/derekparker/gists{/gist_id}","starred_url":"https://api.github.com/users/derekparker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekparker/subscriptions","organizations_url":"https://api.github.com/users/derekparker/orgs","repos_url":"https://api.github.com/users/derekparker/repos","events_url":"https://api.github.com/users/derekparker/events{/privacy}","received_events_url":"https://api.github.com/users/derekparker/received_events","type":"User","site_admin":false},"body":"Yeah I agree with that, however I think it's a different issue, different PR. I will send another patch after this lands.","created_at":"2016-02-16T17:45:43Z","updated_at":"2016-02-16T17:45:43Z","html_url":"https://github.com/derekparker/delve/pull/424#discussion_r53048242","pull_request_url":"https://api.github.com/repos/derekparker/delve/pulls/424","_links":{"self":{"href":"https://api.github.com/repos/derekparker/delve/pulls/comments/53048242"},"html":{"href":"https://github.com/derekparker/delve/pull/424#discussion_r53048242"},"pull_request":{"href":"https://api.github.com/repos/derekparker/delve/pulls/424"}}},"pull_request":{"url":"https://api.github.com/repos/derekparker/delve/pulls/424","id":59444172,"html_url":"https://github.com/derekparker/delve/pull/424","diff_url":"https://github.com/derekparker/delve/pull/424.diff","patch_url":"https://github.com/derekparker/delve/pull/424.patch","issue_url":"https://api.github.com/repos/derekparker/delve/issues/424","number":424,"state":"open","locked":false,"title":"dlv: Take package name in certain commands","user":{"login":"derekparker","id":1314079,"avatar_url":"https://avatars.githubusercontent.com/u/1314079?v=3","gravatar_id":"","url":"https://api.github.com/users/derekparker","html_url":"https://github.com/derekparker","followers_url":"https://api.github.com/users/derekparker/followers","following_url":"https://api.github.com/users/derekparker/following{/other_user}","gists_url":"https://api.github.com/users/derekparker/gists{/gist_id}","starred_url":"https://api.github.com/users/derekparker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekparker/subscriptions","organizations_url":"https://api.github.com/users/derekparker/orgs","repos_url":"https://api.github.com/users/derekparker/repos","events_url":"https://api.github.com/users/derekparker/events{/privacy}","received_events_url":"https://api.github.com/users/derekparker/received_events","type":"User","site_admin":false},"body":"This patch allows certain commands (`debug`, `test`, and `trace`) to\r\ntake an argument specifying a package name. This allows a user to\r\nspecify a package other than that of the current package in the working\r\ndirectory.\r\n\r\nIf a package name is not specified, the behavior remains the same, as in\r\nDelve will look in the current working directory for a `main` package to\r\ncompile.\r\n\r\nFixes #423","created_at":"2016-02-16T05:05:17Z","updated_at":"2016-02-16T17:45:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"edaec631a5d644408e00167e3112451ba0871307","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/derekparker/delve/pulls/424/commits","review_comments_url":"https://api.github.com/repos/derekparker/delve/pulls/424/comments","review_comment_url":"https://api.github.com/repos/derekparker/delve/pulls/comments{/number}","comments_url":"https://api.github.com/repos/derekparker/delve/issues/424/comments","statuses_url":"https://api.github.com/repos/derekparker/delve/statuses/9f2487f4052c4a95558afb9905365715f631ec9e","head":{"label":"derekparker:issue-423","ref":"issue-423","sha":"9f2487f4052c4a95558afb9905365715f631ec9e","user":{"login":"derekparker","id":1314079,"avatar_url":"https://avatars.githubusercontent.com/u/1314079?v=3","gravatar_id":"","url":"https://api.github.com/users/derekparker","html_url":"https://github.com/derekparker","followers_url":"https://api.github.com/users/derekparker/followers","following_url":"https://api.github.com/users/derekparker/following{/other_user}","gists_url":"https://api.github.com/users/derekparker/gists{/gist_id}","starred_url":"https://api.github.com/users/derekparker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekparker/subscriptions","organizations_url":"https://api.github.com/users/derekparker/orgs","repos_url":"https://api.github.com/users/derekparker/repos","events_url":"https://api.github.com/users/derekparker/events{/privacy}","received_events_url":"https://api.github.com/users/derekparker/received_events","type":"User","site_admin":false},"repo":{"id":19994257,"name":"delve","full_name":"derekparker/delve","owner":{"login":"derekparker","id":1314079,"avatar_url":"https://avatars.githubusercontent.com/u/1314079?v=3","gravatar_id":"","url":"https://api.github.com/users/derekparker","html_url":"https://github.com/derekparker","followers_url":"https://api.github.com/users/derekparker/followers","following_url":"https://api.github.com/users/derekparker/following{/other_user}","gists_url":"https://api.github.com/users/derekparker/gists{/gist_id}","starred_url":"https://api.github.com/users/derekparker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekparker/subscriptions","organizations_url":"https://api.github.com/users/derekparker/orgs","repos_url":"https://api.github.com/users/derekparker/repos","events_url":"https://api.github.com/users/derekparker/events{/privacy}","received_events_url":"https://api.github.com/users/derekparker/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/derekparker/delve","description":"Delve is a debugger for the Go programming language.","fork":false,"url":"https://api.github.com/repos/derekparker/delve","forks_url":"https://api.github.com/repos/derekparker/delve/forks","keys_url":"https://api.github.com/repos/derekparker/delve/keys{/key_id}","collaborators_url":"https://api.github.com/repos/derekparker/delve/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/derekparker/delve/teams","hooks_url":"https://api.github.com/repos/derekparker/delve/hooks","issue_events_url":"https://api.github.com/repos/derekparker/delve/issues/events{/number}","events_url":"https://api.github.com/repos/derekparker/delve/events","assignees_url":"https://api.github.com/repos/derekparker/delve/assignees{/user}","branches_url":"https://api.github.com/repos/derekparker/delve/branches{/branch}","tags_url":"https://api.github.com/repos/derekparker/delve/tags","blobs_url":"https://api.github.com/repos/derekparker/delve/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/derekparker/delve/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/derekparker/delve/git/refs{/sha}","trees_url":"https://api.github.com/repos/derekparker/delve/git/trees{/sha}","statuses_url":"https://api.github.com/repos/derekparker/delve/statuses/{sha}","languages_url":"https://api.github.com/repos/derekparker/delve/languages","stargazers_url":"https://api.github.com/repos/derekparker/delve/stargazers","contributors_url":"https://api.github.com/repos/derekparker/delve/contributors","subscribers_url":"https://api.github.com/repos/derekparker/delve/subscribers","subscription_url":"https://api.github.com/repos/derekparker/delve/subscription","commits_url":"https://api.github.com/repos/derekparker/delve/commits{/sha}","git_commits_url":"https://api.github.com/repos/derekparker/delve/git/commits{/sha}","comments_url":"https://api.github.com/repos/derekparker/delve/comments{/number}","issue_comment_url":"https://api.github.com/repos/derekparker/delve/issues/comments{/number}","contents_url":"https://api.github.com/repos/derekparker/delve/contents/{+path}","compare_url":"https://api.github.com/repos/derekparker/delve/compare/{base}...{head}","merges_url":"https://api.github.com/repos/derekparker/delve/merges","archive_url":"https://api.github.com/repos/derekparker/delve/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/derekparker/delve/downloads","issues_url":"https://api.github.com/repos/derekparker/delve/issues{/number}","pulls_url":"https://api.github.com/repos/derekparker/delve/pulls{/number}","milestones_url":"https://api.github.com/repos/derekparker/delve/milestones{/number}","notifications_url":"https://api.github.com/repos/derekparker/delve/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/derekparker/delve/labels{/name}","releases_url":"https://api.github.com/repos/derekparker/delve/releases{/id}","deployments_url":"https://api.github.com/repos/derekparker/delve/deployments","created_at":"2014-05-20T19:24:43Z","updated_at":"2016-02-16T14:56:26Z","pushed_at":"2016-02-16T08:02:41Z","git_url":"git://github.com/derekparker/delve.git","ssh_url":"git@github.com:derekparker/delve.git","clone_url":"https://github.com/derekparker/delve.git","svn_url":"https://github.com/derekparker/delve","homepage":"","size":10680,"stargazers_count":3092,"watchers_count":3092,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":187,"mirror_url":null,"open_issues_count":63,"forks":187,"open_issues":63,"watchers":3092,"default_branch":"master"}},"base":{"label":"derekparker:master","ref":"master","sha":"3360a2e997bf0554e840dde1b83422fabce11ae2","user":{"login":"derekparker","id":1314079,"avatar_url":"https://avatars.githubusercontent.com/u/1314079?v=3","gravatar_id":"","url":"https://api.github.com/users/derekparker","html_url":"https://github.com/derekparker","followers_url":"https://api.github.com/users/derekparker/followers","following_url":"https://api.github.com/users/derekparker/following{/other_user}","gists_url":"https://api.github.com/users/derekparker/gists{/gist_id}","starred_url":"https://api.github.com/users/derekparker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekparker/subscriptions","organizations_url":"https://api.github.com/users/derekparker/orgs","repos_url":"https://api.github.com/users/derekparker/repos","events_url":"https://api.github.com/users/derekparker/events{/privacy}","received_events_url":"https://api.github.com/users/derekparker/received_events","type":"User","site_admin":false},"repo":{"id":19994257,"name":"delve","full_name":"derekparker/delve","owner":{"login":"derekparker","id":1314079,"avatar_url":"https://avatars.githubusercontent.com/u/1314079?v=3","gravatar_id":"","url":"https://api.github.com/users/derekparker","html_url":"https://github.com/derekparker","followers_url":"https://api.github.com/users/derekparker/followers","following_url":"https://api.github.com/users/derekparker/following{/other_user}","gists_url":"https://api.github.com/users/derekparker/gists{/gist_id}","starred_url":"https://api.github.com/users/derekparker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekparker/subscriptions","organizations_url":"https://api.github.com/users/derekparker/orgs","repos_url":"https://api.github.com/users/derekparker/repos","events_url":"https://api.github.com/users/derekparker/events{/privacy}","received_events_url":"https://api.github.com/users/derekparker/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/derekparker/delve","description":"Delve is a debugger for the Go programming language.","fork":false,"url":"https://api.github.com/repos/derekparker/delve","forks_url":"https://api.github.com/repos/derekparker/delve/forks","keys_url":"https://api.github.com/repos/derekparker/delve/keys{/key_id}","collaborators_url":"https://api.github.com/repos/derekparker/delve/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/derekparker/delve/teams","hooks_url":"https://api.github.com/repos/derekparker/delve/hooks","issue_events_url":"https://api.github.com/repos/derekparker/delve/issues/events{/number}","events_url":"https://api.github.com/repos/derekparker/delve/events","assignees_url":"https://api.github.com/repos/derekparker/delve/assignees{/user}","branches_url":"https://api.github.com/repos/derekparker/delve/branches{/branch}","tags_url":"https://api.github.com/repos/derekparker/delve/tags","blobs_url":"https://api.github.com/repos/derekparker/delve/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/derekparker/delve/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/derekparker/delve/git/refs{/sha}","trees_url":"https://api.github.com/repos/derekparker/delve/git/trees{/sha}","statuses_url":"https://api.github.com/repos/derekparker/delve/statuses/{sha}","languages_url":"https://api.github.com/repos/derekparker/delve/languages","stargazers_url":"https://api.github.com/repos/derekparker/delve/stargazers","contributors_url":"https://api.github.com/repos/derekparker/delve/contributors","subscribers_url":"https://api.github.com/repos/derekparker/delve/subscribers","subscription_url":"https://api.github.com/repos/derekparker/delve/subscription","commits_url":"https://api.github.com/repos/derekparker/delve/commits{/sha}","git_commits_url":"https://api.github.com/repos/derekparker/delve/git/commits{/sha}","comments_url":"https://api.github.com/repos/derekparker/delve/comments{/number}","issue_comment_url":"https://api.github.com/repos/derekparker/delve/issues/comments{/number}","contents_url":"https://api.github.com/repos/derekparker/delve/contents/{+path}","compare_url":"https://api.github.com/repos/derekparker/delve/compare/{base}...{head}","merges_url":"https://api.github.com/repos/derekparker/delve/merges","archive_url":"https://api.github.com/repos/derekparker/delve/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/derekparker/delve/downloads","issues_url":"https://api.github.com/repos/derekparker/delve/issues{/number}","pulls_url":"https://api.github.com/repos/derekparker/delve/pulls{/number}","milestones_url":"https://api.github.com/repos/derekparker/delve/milestones{/number}","notifications_url":"https://api.github.com/repos/derekparker/delve/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/derekparker/delve/labels{/name}","releases_url":"https://api.github.com/repos/derekparker/delve/releases{/id}","deployments_url":"https://api.github.com/repos/derekparker/delve/deployments","created_at":"2014-05-20T19:24:43Z","updated_at":"2016-02-16T14:56:26Z","pushed_at":"2016-02-16T08:02:41Z","git_url":"git://github.com/derekparker/delve.git","ssh_url":"git@github.com:derekparker/delve.git","clone_url":"https://github.com/derekparker/delve.git","svn_url":"https://github.com/derekparker/delve","homepage":"","size":10680,"stargazers_count":3092,"watchers_count":3092,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":187,"mirror_url":null,"open_issues_count":63,"forks":187,"open_issues":63,"watchers":3092,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/derekparker/delve/pulls/424"},"html":{"href":"https://github.com/derekparker/delve/pull/424"},"issue":{"href":"https://api.github.com/repos/derekparker/delve/issues/424"},"comments":{"href":"https://api.github.com/repos/derekparker/delve/issues/424/comments"},"review_comments":{"href":"https://api.github.com/repos/derekparker/delve/pulls/424/comments"},"review_comment":{"href":"https://api.github.com/repos/derekparker/delve/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/derekparker/delve/pulls/424/commits"},"statuses":{"href":"https://api.github.com/repos/derekparker/delve/statuses/9f2487f4052c4a95558afb9905365715f631ec9e"}}}}