{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/157765872","pull_request_review_id":84461717,"id":157765872,"diff_hunk":"@@ -0,0 +1,134 @@\n+package cmd\n+\n+import (\n+\t\"fmt\"\n+\t\"io\"\n+\t\"io/ioutil\"\n+\n+\t\"github.com/spf13/cobra\"\n+\n+\t\"github.com/openshift/origin/tools/depcheck/glide\"\n+)\n+\n+var pinImportsExample = `# output the contents of a glide.yaml file with new\n+# imports pinned to a SHA from a given glide.lock file\n+%[1]s pin --glide.lock=/path/to/glide.lock --glide.yaml=/path/to/glide.yaml\n+`\n+\n+type PinImportsOpts struct {\n+\tLockFile *glide.LockFile\n+\tYamlFile *glide.YamlFile\n+\n+\tDecodedYamlBytes []byte\n+\n+\tOut    io.Writer\n+\tErrOut io.Writer\n+}\n+\n+type PinImportsFlags struct {\n+\tLockFileName string\n+\tYamlFileName string\n+}\n+\n+func (o *PinImportsFlags) ToOptions(out, errout io.Writer) (*PinImportsOpts, error) {\n+\tif len(o.LockFileName) == 0 || len(o.YamlFileName) == 0 {\n+\t\treturn nil, fmt.Errorf(\"both a --glide.lock path and a --glide.yaml path must be specified\")\n+\t}\n+\n+\tyamlFileBytes, err := ioutil.ReadFile(o.YamlFileName)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\tlockFileBytes, err := ioutil.ReadFile(o.LockFileName)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\tif len(yamlFileBytes) == 0 {\n+\t\treturn nil, fmt.Errorf(\"--glide.yaml path contained an empty file\")\n+\t}\n+\tif len(lockFileBytes) == 0 {\n+\t\treturn nil, fmt.Errorf(\"--glide.lock path contained an empty file\")\n+\t}\n+\n+\tlockfile := &glide.LockFile{}\n+\tyamlfile := &glide.YamlFile{}\n+\tif err := lockfile.Decode(lockFileBytes); err != nil {\n+\t\treturn nil, err\n+\t}\n+\tif err := yamlfile.Decode(yamlFileBytes); err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\treturn &PinImportsOpts{\n+\t\tLockFile: lockfile,\n+\t\tYamlFile: yamlfile,\n+\n+\t\tDecodedYamlBytes: yamlFileBytes,\n+\n+\t\tOut:    out,\n+\t\tErrOut: errout,\n+\t}, nil\n+}\n+\n+func NewCmdPinImports(parent string, out, errout io.Writer) *cobra.Command {\n+\tflags := &PinImportsFlags{}\n+\n+\tcmd := &cobra.Command{\n+\t\tUse:   \"pin --glide.lock=FOO.lock --glide.yaml=FOO.yaml\",\n+\t\tShort: \"Updates all non-forked dependencies in a glide.yaml file to use the SHAs specified in a glide.lock file.\",","path":"tools/depcheck/pkg/cmd/pin.go","position":79,"original_position":79,"commit_id":"7c8a22de09f8d21a4a9b3138d4a884f2224e66ce","original_commit_id":"7c8a22de09f8d21a4a9b3138d4a884f2224e66ce","user":{"login":"deads2k","id":8225098,"avatar_url":"https://avatars0.githubusercontent.com/u/8225098?v=4","gravatar_id":"","url":"https://api.github.com/users/deads2k","html_url":"https://github.com/deads2k","followers_url":"https://api.github.com/users/deads2k/followers","following_url":"https://api.github.com/users/deads2k/following{/other_user}","gists_url":"https://api.github.com/users/deads2k/gists{/gist_id}","starred_url":"https://api.github.com/users/deads2k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deads2k/subscriptions","organizations_url":"https://api.github.com/users/deads2k/orgs","repos_url":"https://api.github.com/users/deads2k/repos","events_url":"https://api.github.com/users/deads2k/events{/privacy}","received_events_url":"https://api.github.com/users/deads2k/received_events","type":"User","site_admin":false},"body":"Outputs a glide.yaml with all unspecified repos pinned to use SHAs specified in a glide.lock file.","created_at":"2017-12-19T14:18:25Z","updated_at":"2017-12-19T14:18:25Z","html_url":"https://github.com/openshift/origin/pull/17806#discussion_r157765872","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/17806","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/157765872"},"html":{"href":"https://github.com/openshift/origin/pull/17806#discussion_r157765872"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/17806"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/17806","id":158422661,"html_url":"https://github.com/openshift/origin/pull/17806","diff_url":"https://github.com/openshift/origin/pull/17806.diff","patch_url":"https://github.com/openshift/origin/pull/17806.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/17806","number":17806,"state":"open","locked":false,"title":"add glide tool for pinning deps from a lock file","user":{"login":"juanvallejo","id":3902875,"avatar_url":"https://avatars2.githubusercontent.com/u/3902875?v=4","gravatar_id":"","url":"https://api.github.com/users/juanvallejo","html_url":"https://github.com/juanvallejo","followers_url":"https://api.github.com/users/juanvallejo/followers","following_url":"https://api.github.com/users/juanvallejo/following{/other_user}","gists_url":"https://api.github.com/users/juanvallejo/gists{/gist_id}","starred_url":"https://api.github.com/users/juanvallejo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juanvallejo/subscriptions","organizations_url":"https://api.github.com/users/juanvallejo/orgs","repos_url":"https://api.github.com/users/juanvallejo/repos","events_url":"https://api.github.com/users/juanvallejo/events{/privacy}","received_events_url":"https://api.github.com/users/juanvallejo/received_events","type":"User","site_admin":false},"body":"cc @deads2k ","created_at":"2017-12-14T17:50:53Z","updated_at":"2017-12-19T14:18:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9529db82974da1de0fd245885676a6dcb854cf1e","assignee":null,"assignees":[],"requested_reviewers":[{"login":"stevekuznetsov","id":7328370,"avatar_url":"https://avatars1.githubusercontent.com/u/7328370?v=4","gravatar_id":"","url":"https://api.github.com/users/stevekuznetsov","html_url":"https://github.com/stevekuznetsov","followers_url":"https://api.github.com/users/stevekuznetsov/followers","following_url":"https://api.github.com/users/stevekuznetsov/following{/other_user}","gists_url":"https://api.github.com/users/stevekuznetsov/gists{/gist_id}","starred_url":"https://api.github.com/users/stevekuznetsov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevekuznetsov/subscriptions","organizations_url":"https://api.github.com/users/stevekuznetsov/orgs","repos_url":"https://api.github.com/users/stevekuznetsov/repos","events_url":"https://api.github.com/users/stevekuznetsov/events{/privacy}","received_events_url":"https://api.github.com/users/stevekuznetsov/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/17806/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/17806/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/17806/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/7c8a22de09f8d21a4a9b3138d4a884f2224e66ce","head":{"label":"juanvallejo:jvallejo/add-script-for-glide-deps","ref":"jvallejo/add-script-for-glide-deps","sha":"7c8a22de09f8d21a4a9b3138d4a884f2224e66ce","user":{"login":"juanvallejo","id":3902875,"avatar_url":"https://avatars2.githubusercontent.com/u/3902875?v=4","gravatar_id":"","url":"https://api.github.com/users/juanvallejo","html_url":"https://github.com/juanvallejo","followers_url":"https://api.github.com/users/juanvallejo/followers","following_url":"https://api.github.com/users/juanvallejo/following{/other_user}","gists_url":"https://api.github.com/users/juanvallejo/gists{/gist_id}","starred_url":"https://api.github.com/users/juanvallejo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juanvallejo/subscriptions","organizations_url":"https://api.github.com/users/juanvallejo/orgs","repos_url":"https://api.github.com/users/juanvallejo/repos","events_url":"https://api.github.com/users/juanvallejo/events{/privacy}","received_events_url":"https://api.github.com/users/juanvallejo/received_events","type":"User","site_admin":false},"repo":{"id":50698131,"name":"origin","full_name":"juanvallejo/origin","owner":{"login":"juanvallejo","id":3902875,"avatar_url":"https://avatars2.githubusercontent.com/u/3902875?v=4","gravatar_id":"","url":"https://api.github.com/users/juanvallejo","html_url":"https://github.com/juanvallejo","followers_url":"https://api.github.com/users/juanvallejo/followers","following_url":"https://api.github.com/users/juanvallejo/following{/other_user}","gists_url":"https://api.github.com/users/juanvallejo/gists{/gist_id}","starred_url":"https://api.github.com/users/juanvallejo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juanvallejo/subscriptions","organizations_url":"https://api.github.com/users/juanvallejo/orgs","repos_url":"https://api.github.com/users/juanvallejo/repos","events_url":"https://api.github.com/users/juanvallejo/events{/privacy}","received_events_url":"https://api.github.com/users/juanvallejo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/juanvallejo/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/juanvallejo/origin","forks_url":"https://api.github.com/repos/juanvallejo/origin/forks","keys_url":"https://api.github.com/repos/juanvallejo/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juanvallejo/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juanvallejo/origin/teams","hooks_url":"https://api.github.com/repos/juanvallejo/origin/hooks","issue_events_url":"https://api.github.com/repos/juanvallejo/origin/issues/events{/number}","events_url":"https://api.github.com/repos/juanvallejo/origin/events","assignees_url":"https://api.github.com/repos/juanvallejo/origin/assignees{/user}","branches_url":"https://api.github.com/repos/juanvallejo/origin/branches{/branch}","tags_url":"https://api.github.com/repos/juanvallejo/origin/tags","blobs_url":"https://api.github.com/repos/juanvallejo/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juanvallejo/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juanvallejo/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/juanvallejo/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juanvallejo/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/juanvallejo/origin/languages","stargazers_url":"https://api.github.com/repos/juanvallejo/origin/stargazers","contributors_url":"https://api.github.com/repos/juanvallejo/origin/contributors","subscribers_url":"https://api.github.com/repos/juanvallejo/origin/subscribers","subscription_url":"https://api.github.com/repos/juanvallejo/origin/subscription","commits_url":"https://api.github.com/repos/juanvallejo/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/juanvallejo/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/juanvallejo/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/juanvallejo/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/juanvallejo/origin/contents/{+path}","compare_url":"https://api.github.com/repos/juanvallejo/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juanvallejo/origin/merges","archive_url":"https://api.github.com/repos/juanvallejo/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juanvallejo/origin/downloads","issues_url":"https://api.github.com/repos/juanvallejo/origin/issues{/number}","pulls_url":"https://api.github.com/repos/juanvallejo/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/juanvallejo/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/juanvallejo/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juanvallejo/origin/labels{/name}","releases_url":"https://api.github.com/repos/juanvallejo/origin/releases{/id}","deployments_url":"https://api.github.com/repos/juanvallejo/origin/deployments","created_at":"2016-01-29T23:22:53Z","updated_at":"2016-01-29T23:22:58Z","pushed_at":"2017-12-19T00:30:09Z","git_url":"git://github.com/juanvallejo/origin.git","ssh_url":"git@github.com:juanvallejo/origin.git","clone_url":"https://github.com/juanvallejo/origin.git","svn_url":"https://github.com/juanvallejo/origin","homepage":"http://www.openshift.org","size":892824,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"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"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"1c24d18c05bf0ccb36fc9d5d219f9711efc8e36d","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars3.githubusercontent.com/u/792337?v=4","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":22442668,"name":"origin","full_name":"openshift/origin","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars3.githubusercontent.com/u/792337?v=4","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/origin","description":"Enterprise Kubernetes for Developers","fork":false,"url":"https://api.github.com/repos/openshift/origin","forks_url":"https://api.github.com/repos/openshift/origin/forks","keys_url":"https://api.github.com/repos/openshift/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/origin/teams","hooks_url":"https://api.github.com/repos/openshift/origin/hooks","issue_events_url":"https://api.github.com/repos/openshift/origin/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/origin/events","assignees_url":"https://api.github.com/repos/openshift/origin/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/origin/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/origin/tags","blobs_url":"https://api.github.com/repos/openshift/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/origin/languages","stargazers_url":"https://api.github.com/repos/openshift/origin/stargazers","contributors_url":"https://api.github.com/repos/openshift/origin/contributors","subscribers_url":"https://api.github.com/repos/openshift/origin/subscribers","subscription_url":"https://api.github.com/repos/openshift/origin/subscription","commits_url":"https://api.github.com/repos/openshift/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/origin/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/origin/merges","archive_url":"https://api.github.com/repos/openshift/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/origin/downloads","issues_url":"https://api.github.com/repos/openshift/origin/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/origin/labels{/name}","releases_url":"https://api.github.com/repos/openshift/origin/releases{/id}","deployments_url":"https://api.github.com/repos/openshift/origin/deployments","created_at":"2014-07-30T20:04:05Z","updated_at":"2017-12-19T05:17:07Z","pushed_at":"2017-12-19T14:08:29Z","git_url":"git://github.com/openshift/origin.git","ssh_url":"git@github.com:openshift/origin.git","clone_url":"https://github.com/openshift/origin.git","svn_url":"https://github.com/openshift/origin","homepage":"http://www.openshift.org","size":937525,"stargazers_count":3791,"watchers_count":3791,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2436,"mirror_url":null,"archived":false,"open_issues_count":1691,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":2436,"open_issues":1691,"watchers":3791,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/17806"},"html":{"href":"https://github.com/openshift/origin/pull/17806"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/17806"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/17806/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/17806/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/17806/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/7c8a22de09f8d21a4a9b3138d4a884f2224e66ce"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"deads2k"}}