{"action":"created","comment":{"url":"https://api.github.com/repos/moby/moby/pulls/comments/230037216","pull_request_review_id":170677527,"id":230037216,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMDAzNzIxNg==","diff_hunk":"@@ -6,14 +6,14 @@ set -eo pipefail\n \n # debian                           latest              f6fab3b798be        10 weeks ago        85.1 MB\n # debian                           latest              f6fab3b798be3174f45aa1eb731f8182705555f89c9026d8c1ef230cbf8301dd   10 weeks ago        85.1 MB\n-if ! command -v curl &> /dev/null; then\n-\techo >&2 'error: \"curl\" not found!'\n-\texit 1\n-fi\n-if ! command -v jq &> /dev/null; then\n-\techo >&2 'error: \"jq\" not found!'\n-\texit 1\n-fi\n+\n+# Test essential commands are in our PATH\n+for cmd in curl jq go; do\n+    if ! command -v $cmd &> /dev/null; then\n+\t    echo >&2 \"error: \\\"$cmd\\\" not found!\"","path":"contrib/download-frozen-image-v2.sh","position":16,"original_position":16,"commit_id":"a291343782a0aa360f9cd5d4761ea9561cfdb479","original_commit_id":"a291343782a0aa360f9cd5d4761ea9561cfdb479","user":{"login":"thaJeztah","id":1804568,"node_id":"MDQ6VXNlcjE4MDQ1Njg=","avatar_url":"https://avatars2.githubusercontent.com/u/1804568?v=4","gravatar_id":"","url":"https://api.github.com/users/thaJeztah","html_url":"https://github.com/thaJeztah","followers_url":"https://api.github.com/users/thaJeztah/followers","following_url":"https://api.github.com/users/thaJeztah/following{/other_user}","gists_url":"https://api.github.com/users/thaJeztah/gists{/gist_id}","starred_url":"https://api.github.com/users/thaJeztah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thaJeztah/subscriptions","organizations_url":"https://api.github.com/users/thaJeztah/orgs","repos_url":"https://api.github.com/users/thaJeztah/repos","events_url":"https://api.github.com/users/thaJeztah/events{/privacy}","received_events_url":"https://api.github.com/users/thaJeztah/received_events","type":"User","site_admin":false},"body":"oh! Looks like you're using mixed tabs and spaces for indentation here 😅 - we standardise on using tabs for indentation in scripts;\r\n\r\n```suggestion\r\n# check if essential commands are in our PATH\r\nfor cmd in curl jq go; do\r\n\tif ! command -v $cmd &> /dev/null; then\r\n\t\techo >&2 \"error: \\\"$cmd\\\" not found!\"\r\n\t\texit 1\r\n\tfi\r\ndone\r\n```","created_at":"2018-11-01T13:12:50Z","updated_at":"2018-11-01T13:14:49Z","html_url":"https://github.com/moby/moby/pull/38122#discussion_r230037216","pull_request_url":"https://api.github.com/repos/moby/moby/pulls/38122","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/moby/moby/pulls/comments/230037216"},"html":{"href":"https://github.com/moby/moby/pull/38122#discussion_r230037216"},"pull_request":{"href":"https://api.github.com/repos/moby/moby/pulls/38122"}}},"pull_request":{"url":"https://api.github.com/repos/moby/moby/pulls/38122","id":227504934,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3NTA0OTM0","html_url":"https://github.com/moby/moby/pull/38122","diff_url":"https://github.com/moby/moby/pull/38122.diff","patch_url":"https://github.com/moby/moby/pull/38122.patch","issue_url":"https://api.github.com/repos/moby/moby/issues/38122","number":38122,"state":"open","locked":false,"title":"Fix error handling when go command is missing","user":{"login":"mjeromin","id":4604605,"node_id":"MDQ6VXNlcjQ2MDQ2MDU=","avatar_url":"https://avatars2.githubusercontent.com/u/4604605?v=4","gravatar_id":"","url":"https://api.github.com/users/mjeromin","html_url":"https://github.com/mjeromin","followers_url":"https://api.github.com/users/mjeromin/followers","following_url":"https://api.github.com/users/mjeromin/following{/other_user}","gists_url":"https://api.github.com/users/mjeromin/gists{/gist_id}","starred_url":"https://api.github.com/users/mjeromin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjeromin/subscriptions","organizations_url":"https://api.github.com/users/mjeromin/orgs","repos_url":"https://api.github.com/users/mjeromin/repos","events_url":"https://api.github.com/users/mjeromin/events{/privacy}","received_events_url":"https://api.github.com/users/mjeromin/received_events","type":"User","site_admin":false},"body":"Signed-off-by: Mark Jeromin <mark.jeromin@sysfrog.net>\r\n\r\nFixes #38070 **_download-frozen-image-v2.sh does not contain a check to detect if go is in the PATH_**\r\n\r\n**- What I did**\r\nI added a test to check that `go` is in the user's shell `$PATH`, otherwise it will print a friendly error message `error: \"go\" not found!` when `go` is not in the `$PATH`. \r\n\r\n**- How I did it**\r\n@thaJeztah suggested a solution that doesn't increase the complexity of the script much, so I consolidated the tests into a single loop. This allows a consistent error message for missing commands, rather than three (or more) separate tests (ie. `curl`, `jq`, `go`).\r\n\r\n**- Description for the changelog**\r\nRefactor error handling for missing commands.\r\n\r\n![jack 016-xl](https://user-images.githubusercontent.com/4604605/47830486-67095b00-dd62-11e8-9d11-8a3f2d7c4c42.jpg)\r\n\r\n\r\n\r\n\r\n","created_at":"2018-11-01T03:46:01Z","updated_at":"2018-11-01T13:14:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"26864aad046f86c217361f0bfb3ded393e05f60c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":175374554,"node_id":"MDU6TGFiZWwxNzUzNzQ1NTQ=","url":"https://api.github.com/repos/moby/moby/labels/status/0-triage","name":"status/0-triage","color":"EEEEEE","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/moby/moby/pulls/38122/commits","review_comments_url":"https://api.github.com/repos/moby/moby/pulls/38122/comments","review_comment_url":"https://api.github.com/repos/moby/moby/pulls/comments{/number}","comments_url":"https://api.github.com/repos/moby/moby/issues/38122/comments","statuses_url":"https://api.github.com/repos/moby/moby/statuses/a291343782a0aa360f9cd5d4761ea9561cfdb479","head":{"label":"mjeromin:38070-go-command-detect","ref":"38070-go-command-detect","sha":"a291343782a0aa360f9cd5d4761ea9561cfdb479","user":{"login":"mjeromin","id":4604605,"node_id":"MDQ6VXNlcjQ2MDQ2MDU=","avatar_url":"https://avatars2.githubusercontent.com/u/4604605?v=4","gravatar_id":"","url":"https://api.github.com/users/mjeromin","html_url":"https://github.com/mjeromin","followers_url":"https://api.github.com/users/mjeromin/followers","following_url":"https://api.github.com/users/mjeromin/following{/other_user}","gists_url":"https://api.github.com/users/mjeromin/gists{/gist_id}","starred_url":"https://api.github.com/users/mjeromin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjeromin/subscriptions","organizations_url":"https://api.github.com/users/mjeromin/orgs","repos_url":"https://api.github.com/users/mjeromin/repos","events_url":"https://api.github.com/users/mjeromin/events{/privacy}","received_events_url":"https://api.github.com/users/mjeromin/received_events","type":"User","site_admin":false},"repo":{"id":155646242,"node_id":"MDEwOlJlcG9zaXRvcnkxNTU2NDYyNDI=","name":"moby","full_name":"mjeromin/moby","private":false,"owner":{"login":"mjeromin","id":4604605,"node_id":"MDQ6VXNlcjQ2MDQ2MDU=","avatar_url":"https://avatars2.githubusercontent.com/u/4604605?v=4","gravatar_id":"","url":"https://api.github.com/users/mjeromin","html_url":"https://github.com/mjeromin","followers_url":"https://api.github.com/users/mjeromin/followers","following_url":"https://api.github.com/users/mjeromin/following{/other_user}","gists_url":"https://api.github.com/users/mjeromin/gists{/gist_id}","starred_url":"https://api.github.com/users/mjeromin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjeromin/subscriptions","organizations_url":"https://api.github.com/users/mjeromin/orgs","repos_url":"https://api.github.com/users/mjeromin/repos","events_url":"https://api.github.com/users/mjeromin/events{/privacy}","received_events_url":"https://api.github.com/users/mjeromin/received_events","type":"User","site_admin":false},"html_url":"https://github.com/mjeromin/moby","description":"Moby Project - a collaborative project for the container ecosystem to assemble container-based systems","fork":true,"url":"https://api.github.com/repos/mjeromin/moby","forks_url":"https://api.github.com/repos/mjeromin/moby/forks","keys_url":"https://api.github.com/repos/mjeromin/moby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mjeromin/moby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mjeromin/moby/teams","hooks_url":"https://api.github.com/repos/mjeromin/moby/hooks","issue_events_url":"https://api.github.com/repos/mjeromin/moby/issues/events{/number}","events_url":"https://api.github.com/repos/mjeromin/moby/events","assignees_url":"https://api.github.com/repos/mjeromin/moby/assignees{/user}","branches_url":"https://api.github.com/repos/mjeromin/moby/branches{/branch}","tags_url":"https://api.github.com/repos/mjeromin/moby/tags","blobs_url":"https://api.github.com/repos/mjeromin/moby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mjeromin/moby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mjeromin/moby/git/refs{/sha}","trees_url":"https://api.github.com/repos/mjeromin/moby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mjeromin/moby/statuses/{sha}","languages_url":"https://api.github.com/repos/mjeromin/moby/languages","stargazers_url":"https://api.github.com/repos/mjeromin/moby/stargazers","contributors_url":"https://api.github.com/repos/mjeromin/moby/contributors","subscribers_url":"https://api.github.com/repos/mjeromin/moby/subscribers","subscription_url":"https://api.github.com/repos/mjeromin/moby/subscription","commits_url":"https://api.github.com/repos/mjeromin/moby/commits{/sha}","git_commits_url":"https://api.github.com/repos/mjeromin/moby/git/commits{/sha}","comments_url":"https://api.github.com/repos/mjeromin/moby/comments{/number}","issue_comment_url":"https://api.github.com/repos/mjeromin/moby/issues/comments{/number}","contents_url":"https://api.github.com/repos/mjeromin/moby/contents/{+path}","compare_url":"https://api.github.com/repos/mjeromin/moby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mjeromin/moby/merges","archive_url":"https://api.github.com/repos/mjeromin/moby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mjeromin/moby/downloads","issues_url":"https://api.github.com/repos/mjeromin/moby/issues{/number}","pulls_url":"https://api.github.com/repos/mjeromin/moby/pulls{/number}","milestones_url":"https://api.github.com/repos/mjeromin/moby/milestones{/number}","notifications_url":"https://api.github.com/repos/mjeromin/moby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mjeromin/moby/labels{/name}","releases_url":"https://api.github.com/repos/mjeromin/moby/releases{/id}","deployments_url":"https://api.github.com/repos/mjeromin/moby/deployments","created_at":"2018-11-01T01:43:33Z","updated_at":"2018-11-01T01:43:44Z","pushed_at":"2018-11-01T03:29:10Z","git_url":"git://github.com/mjeromin/moby.git","ssh_url":"git@github.com:mjeromin/moby.git","clone_url":"https://github.com/mjeromin/moby.git","svn_url":"https://github.com/mjeromin/moby","homepage":"https://mobyproject.org/","size":139660,"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":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"moby:master","ref":"master","sha":"104cbc07802722b67307e95584592e7c6102ead7","user":{"login":"moby","id":27259197,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI3MjU5MTk3","avatar_url":"https://avatars1.githubusercontent.com/u/27259197?v=4","gravatar_id":"","url":"https://api.github.com/users/moby","html_url":"https://github.com/moby","followers_url":"https://api.github.com/users/moby/followers","following_url":"https://api.github.com/users/moby/following{/other_user}","gists_url":"https://api.github.com/users/moby/gists{/gist_id}","starred_url":"https://api.github.com/users/moby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moby/subscriptions","organizations_url":"https://api.github.com/users/moby/orgs","repos_url":"https://api.github.com/users/moby/repos","events_url":"https://api.github.com/users/moby/events{/privacy}","received_events_url":"https://api.github.com/users/moby/received_events","type":"Organization","site_admin":false},"repo":{"id":7691631,"node_id":"MDEwOlJlcG9zaXRvcnk3NjkxNjMx","name":"moby","full_name":"moby/moby","private":false,"owner":{"login":"moby","id":27259197,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI3MjU5MTk3","avatar_url":"https://avatars1.githubusercontent.com/u/27259197?v=4","gravatar_id":"","url":"https://api.github.com/users/moby","html_url":"https://github.com/moby","followers_url":"https://api.github.com/users/moby/followers","following_url":"https://api.github.com/users/moby/following{/other_user}","gists_url":"https://api.github.com/users/moby/gists{/gist_id}","starred_url":"https://api.github.com/users/moby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moby/subscriptions","organizations_url":"https://api.github.com/users/moby/orgs","repos_url":"https://api.github.com/users/moby/repos","events_url":"https://api.github.com/users/moby/events{/privacy}","received_events_url":"https://api.github.com/users/moby/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/moby/moby","description":"Moby Project - a collaborative project for the container ecosystem to assemble container-based systems","fork":false,"url":"https://api.github.com/repos/moby/moby","forks_url":"https://api.github.com/repos/moby/moby/forks","keys_url":"https://api.github.com/repos/moby/moby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moby/moby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moby/moby/teams","hooks_url":"https://api.github.com/repos/moby/moby/hooks","issue_events_url":"https://api.github.com/repos/moby/moby/issues/events{/number}","events_url":"https://api.github.com/repos/moby/moby/events","assignees_url":"https://api.github.com/repos/moby/moby/assignees{/user}","branches_url":"https://api.github.com/repos/moby/moby/branches{/branch}","tags_url":"https://api.github.com/repos/moby/moby/tags","blobs_url":"https://api.github.com/repos/moby/moby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moby/moby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moby/moby/git/refs{/sha}","trees_url":"https://api.github.com/repos/moby/moby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moby/moby/statuses/{sha}","languages_url":"https://api.github.com/repos/moby/moby/languages","stargazers_url":"https://api.github.com/repos/moby/moby/stargazers","contributors_url":"https://api.github.com/repos/moby/moby/contributors","subscribers_url":"https://api.github.com/repos/moby/moby/subscribers","subscription_url":"https://api.github.com/repos/moby/moby/subscription","commits_url":"https://api.github.com/repos/moby/moby/commits{/sha}","git_commits_url":"https://api.github.com/repos/moby/moby/git/commits{/sha}","comments_url":"https://api.github.com/repos/moby/moby/comments{/number}","issue_comment_url":"https://api.github.com/repos/moby/moby/issues/comments{/number}","contents_url":"https://api.github.com/repos/moby/moby/contents/{+path}","compare_url":"https://api.github.com/repos/moby/moby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moby/moby/merges","archive_url":"https://api.github.com/repos/moby/moby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moby/moby/downloads","issues_url":"https://api.github.com/repos/moby/moby/issues{/number}","pulls_url":"https://api.github.com/repos/moby/moby/pulls{/number}","milestones_url":"https://api.github.com/repos/moby/moby/milestones{/number}","notifications_url":"https://api.github.com/repos/moby/moby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moby/moby/labels{/name}","releases_url":"https://api.github.com/repos/moby/moby/releases{/id}","deployments_url":"https://api.github.com/repos/moby/moby/deployments","created_at":"2013-01-18T18:10:57Z","updated_at":"2018-11-01T12:57:44Z","pushed_at":"2018-11-01T12:26:33Z","git_url":"git://github.com/moby/moby.git","ssh_url":"git@github.com:moby/moby.git","clone_url":"https://github.com/moby/moby.git","svn_url":"https://github.com/moby/moby","homepage":"https://mobyproject.org/","size":139670,"stargazers_count":50908,"watchers_count":50908,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14813,"mirror_url":null,"archived":false,"open_issues_count":3441,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":14813,"open_issues":3441,"watchers":50908,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/moby/moby/pulls/38122"},"html":{"href":"https://github.com/moby/moby/pull/38122"},"issue":{"href":"https://api.github.com/repos/moby/moby/issues/38122"},"comments":{"href":"https://api.github.com/repos/moby/moby/issues/38122/comments"},"review_comments":{"href":"https://api.github.com/repos/moby/moby/pulls/38122/comments"},"review_comment":{"href":"https://api.github.com/repos/moby/moby/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/moby/moby/pulls/38122/commits"},"statuses":{"href":"https://api.github.com/repos/moby/moby/statuses/a291343782a0aa360f9cd5d4761ea9561cfdb479"}},"author_association":"NONE"}}
{"actor":{"display_login":"thaJeztah"}}