{"action":"created","comment":{"url":"https://api.github.com/repos/hashicorp/consul/pulls/comments/42786614","id":42786614,"diff_hunk":"@@ -16,37 +16,67 @@ GIT_COMMIT=$(git rev-parse HEAD)\n GIT_DIRTY=$(test -n \"`git status --porcelain`\" && echo \"+CHANGES\" || true)\n GIT_DESCRIBE=$(git describe --tags)\n \n-# If we're building on Windows, specify an extension\n-EXTENSION=\"\"\n-if [ \"$(go env GOOS)\" = \"windows\" ]; then\n-    EXTENSION=\".exe\"\n-fi\n+# Determine the arch/os combos we're building for\n+XC_ARCH=${XC_ARCH:-\"386 amd64 arm\"}\n+XC_OS=${XC_OS:-\"darwin freebsd linux netbsd openbsd windows\"}\n \n-GOPATHSINGLE=${GOPATH%%:*}\n-if [ \"$(go env GOOS)\" = \"windows\" ]; then\n-    GOPATHSINGLE=${GOPATH%%;*}\n-fi\n+# Install dependencies\n+echo \"==> Getting dependencies...\"\n+go get ./...\n \n-if [ \"$(go env GOOS)\" = \"freebsd\" ]; then\n-  export CC=\"clang\"\n-fi\n+# Delete the old dir\n+echo \"==> Removing old directory...\"\n+rm -f bin/*\n+rm -rf pkg/*\n+mkdir -p bin/\n \n-# On OSX, we need to use an older target to ensure binaries are\n-# compatible with older linkers\n-if [ \"$(go env GOOS)\" = \"darwin\" ]; then\n-    export MACOSX_DEPLOYMENT_TARGET=10.6\n+# If its dev mode, only build for ourself\n+if [ \"${CONSUL_DEV}x\" != \"x\" ]; then\n+    XC_OS=$(go env GOOS)\n+    XC_ARCH=$(go env GOARCH)\n fi\n \n-# Install dependencies\n-echo \"--> Installing dependencies to speed up builds...\"\n-go get \\\n-  -ldflags \"${CGO_LDFLAGS}\" \\\n-  ./...\n-\n # Build!\n-echo \"--> Building...\"\n-go build \\\n-    -ldflags \"${CGO_LDFLAGS} -X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -X main.GitDescribe=${GIT_DESCRIBE}\" \\\n-    -v \\\n-    -o bin/consul${EXTENSION}\n-cp bin/consul${EXTENSION} \"${GOPATHSINGLE}/bin\"\n+echo \"==> Building...\"\n+gox \\\n+    -os=\"${XC_OS}\" \\\n+    -arch=\"${XC_ARCH}\" \\\n+    -ldflags \"-X main.GitCommit ${GIT_COMMIT}${GIT_DIRTY} -X main.GitDescribe ${GIT_DESCRIBE}\" \\\n+    -output \"pkg/{{.OS}}_{{.Arch}}/consul\" \\\n+    .\n+\n+# Move all the compiled things to the $GOPATH/bin\n+GOPATH=${GOPATH:-$(go env GOPATH)}\n+case $(uname) in\n+    CYGWIN*)\n+        GOPATH=\"$(cygpath $GOPATH)\"\n+        ;;\n+esac\n+OLDIFS=$IFS\n+IFS=: MAIN_GOPATH=($GOPATH)","path":"scripts/build.sh","position":78,"original_position":78,"commit_id":"6c528f0ff25053ec9f968a349ac9fdea295735b7","original_commit_id":"6c528f0ff25053ec9f968a349ac9fdea295735b7","user":{"login":"slackpad","id":673509,"avatar_url":"https://avatars.githubusercontent.com/u/673509?v=3","gravatar_id":"","url":"https://api.github.com/users/slackpad","html_url":"https://github.com/slackpad","followers_url":"https://api.github.com/users/slackpad/followers","following_url":"https://api.github.com/users/slackpad/following{/other_user}","gists_url":"https://api.github.com/users/slackpad/gists{/gist_id}","starred_url":"https://api.github.com/users/slackpad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slackpad/subscriptions","organizations_url":"https://api.github.com/users/slackpad/orgs","repos_url":"https://api.github.com/users/slackpad/repos","events_url":"https://api.github.com/users/slackpad/events{/privacy}","received_events_url":"https://api.github.com/users/slackpad/received_events","type":"User","site_admin":false},"body":"What does this do?","created_at":"2015-10-22T18:27:44Z","updated_at":"2015-10-22T18:27:44Z","html_url":"https://github.com/hashicorp/consul/pull/1328#discussion_r42786614","pull_request_url":"https://api.github.com/repos/hashicorp/consul/pulls/1328","_links":{"self":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/comments/42786614"},"html":{"href":"https://github.com/hashicorp/consul/pull/1328#discussion_r42786614"},"pull_request":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/1328"}}},"pull_request":{"url":"https://api.github.com/repos/hashicorp/consul/pulls/1328","id":48492915,"html_url":"https://github.com/hashicorp/consul/pull/1328","diff_url":"https://github.com/hashicorp/consul/pull/1328.diff","patch_url":"https://github.com/hashicorp/consul/pull/1328.patch","issue_url":"https://api.github.com/repos/hashicorp/consul/issues/1328","number":1328,"state":"open","locked":false,"title":"Use gox for building","user":{"login":"sethvargo","id":408570,"avatar_url":"https://avatars.githubusercontent.com/u/408570?v=3","gravatar_id":"","url":"https://api.github.com/users/sethvargo","html_url":"https://github.com/sethvargo","followers_url":"https://api.github.com/users/sethvargo/followers","following_url":"https://api.github.com/users/sethvargo/following{/other_user}","gists_url":"https://api.github.com/users/sethvargo/gists{/gist_id}","starred_url":"https://api.github.com/users/sethvargo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethvargo/subscriptions","organizations_url":"https://api.github.com/users/sethvargo/orgs","repos_url":"https://api.github.com/users/sethvargo/repos","events_url":"https://api.github.com/users/sethvargo/events{/privacy}","received_events_url":"https://api.github.com/users/sethvargo/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-22T18:16:56Z","updated_at":"2015-10-22T18:27:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3bb8b2465847e5807ddd9dc9a389a59e0d1febbf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hashicorp/consul/pulls/1328/commits","review_comments_url":"https://api.github.com/repos/hashicorp/consul/pulls/1328/comments","review_comment_url":"https://api.github.com/repos/hashicorp/consul/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hashicorp/consul/issues/1328/comments","statuses_url":"https://api.github.com/repos/hashicorp/consul/statuses/6c528f0ff25053ec9f968a349ac9fdea295735b7","head":{"label":"hashicorp:sethvargo/build_gox","ref":"sethvargo/build_gox","sha":"6c528f0ff25053ec9f968a349ac9fdea295735b7","user":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"repo":{"id":14125254,"name":"consul","full_name":"hashicorp/consul","owner":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hashicorp/consul","description":"Consul is a tool for service discovery, monitoring and configuration.","fork":false,"url":"https://api.github.com/repos/hashicorp/consul","forks_url":"https://api.github.com/repos/hashicorp/consul/forks","keys_url":"https://api.github.com/repos/hashicorp/consul/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hashicorp/consul/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hashicorp/consul/teams","hooks_url":"https://api.github.com/repos/hashicorp/consul/hooks","issue_events_url":"https://api.github.com/repos/hashicorp/consul/issues/events{/number}","events_url":"https://api.github.com/repos/hashicorp/consul/events","assignees_url":"https://api.github.com/repos/hashicorp/consul/assignees{/user}","branches_url":"https://api.github.com/repos/hashicorp/consul/branches{/branch}","tags_url":"https://api.github.com/repos/hashicorp/consul/tags","blobs_url":"https://api.github.com/repos/hashicorp/consul/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hashicorp/consul/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hashicorp/consul/git/refs{/sha}","trees_url":"https://api.github.com/repos/hashicorp/consul/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hashicorp/consul/statuses/{sha}","languages_url":"https://api.github.com/repos/hashicorp/consul/languages","stargazers_url":"https://api.github.com/repos/hashicorp/consul/stargazers","contributors_url":"https://api.github.com/repos/hashicorp/consul/contributors","subscribers_url":"https://api.github.com/repos/hashicorp/consul/subscribers","subscription_url":"https://api.github.com/repos/hashicorp/consul/subscription","commits_url":"https://api.github.com/repos/hashicorp/consul/commits{/sha}","git_commits_url":"https://api.github.com/repos/hashicorp/consul/git/commits{/sha}","comments_url":"https://api.github.com/repos/hashicorp/consul/comments{/number}","issue_comment_url":"https://api.github.com/repos/hashicorp/consul/issues/comments{/number}","contents_url":"https://api.github.com/repos/hashicorp/consul/contents/{+path}","compare_url":"https://api.github.com/repos/hashicorp/consul/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hashicorp/consul/merges","archive_url":"https://api.github.com/repos/hashicorp/consul/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hashicorp/consul/downloads","issues_url":"https://api.github.com/repos/hashicorp/consul/issues{/number}","pulls_url":"https://api.github.com/repos/hashicorp/consul/pulls{/number}","milestones_url":"https://api.github.com/repos/hashicorp/consul/milestones{/number}","notifications_url":"https://api.github.com/repos/hashicorp/consul/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hashicorp/consul/labels{/name}","releases_url":"https://api.github.com/repos/hashicorp/consul/releases{/id}","created_at":"2013-11-04T22:15:27Z","updated_at":"2015-10-22T18:21:53Z","pushed_at":"2015-10-22T18:16:56Z","git_url":"git://github.com/hashicorp/consul.git","ssh_url":"git@github.com:hashicorp/consul.git","clone_url":"https://github.com/hashicorp/consul.git","svn_url":"https://github.com/hashicorp/consul","homepage":"http://www.consul.io","size":17775,"stargazers_count":4730,"watchers_count":4730,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":582,"mirror_url":null,"open_issues_count":308,"forks":582,"open_issues":308,"watchers":4730,"default_branch":"master"}},"base":{"label":"hashicorp:master","ref":"master","sha":"1e3840b04408d4c481a1e50db462cf520afe113a","user":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"repo":{"id":14125254,"name":"consul","full_name":"hashicorp/consul","owner":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hashicorp/consul","description":"Consul is a tool for service discovery, monitoring and configuration.","fork":false,"url":"https://api.github.com/repos/hashicorp/consul","forks_url":"https://api.github.com/repos/hashicorp/consul/forks","keys_url":"https://api.github.com/repos/hashicorp/consul/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hashicorp/consul/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hashicorp/consul/teams","hooks_url":"https://api.github.com/repos/hashicorp/consul/hooks","issue_events_url":"https://api.github.com/repos/hashicorp/consul/issues/events{/number}","events_url":"https://api.github.com/repos/hashicorp/consul/events","assignees_url":"https://api.github.com/repos/hashicorp/consul/assignees{/user}","branches_url":"https://api.github.com/repos/hashicorp/consul/branches{/branch}","tags_url":"https://api.github.com/repos/hashicorp/consul/tags","blobs_url":"https://api.github.com/repos/hashicorp/consul/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hashicorp/consul/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hashicorp/consul/git/refs{/sha}","trees_url":"https://api.github.com/repos/hashicorp/consul/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hashicorp/consul/statuses/{sha}","languages_url":"https://api.github.com/repos/hashicorp/consul/languages","stargazers_url":"https://api.github.com/repos/hashicorp/consul/stargazers","contributors_url":"https://api.github.com/repos/hashicorp/consul/contributors","subscribers_url":"https://api.github.com/repos/hashicorp/consul/subscribers","subscription_url":"https://api.github.com/repos/hashicorp/consul/subscription","commits_url":"https://api.github.com/repos/hashicorp/consul/commits{/sha}","git_commits_url":"https://api.github.com/repos/hashicorp/consul/git/commits{/sha}","comments_url":"https://api.github.com/repos/hashicorp/consul/comments{/number}","issue_comment_url":"https://api.github.com/repos/hashicorp/consul/issues/comments{/number}","contents_url":"https://api.github.com/repos/hashicorp/consul/contents/{+path}","compare_url":"https://api.github.com/repos/hashicorp/consul/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hashicorp/consul/merges","archive_url":"https://api.github.com/repos/hashicorp/consul/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hashicorp/consul/downloads","issues_url":"https://api.github.com/repos/hashicorp/consul/issues{/number}","pulls_url":"https://api.github.com/repos/hashicorp/consul/pulls{/number}","milestones_url":"https://api.github.com/repos/hashicorp/consul/milestones{/number}","notifications_url":"https://api.github.com/repos/hashicorp/consul/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hashicorp/consul/labels{/name}","releases_url":"https://api.github.com/repos/hashicorp/consul/releases{/id}","created_at":"2013-11-04T22:15:27Z","updated_at":"2015-10-22T18:21:53Z","pushed_at":"2015-10-22T18:16:56Z","git_url":"git://github.com/hashicorp/consul.git","ssh_url":"git@github.com:hashicorp/consul.git","clone_url":"https://github.com/hashicorp/consul.git","svn_url":"https://github.com/hashicorp/consul","homepage":"http://www.consul.io","size":17775,"stargazers_count":4730,"watchers_count":4730,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":582,"mirror_url":null,"open_issues_count":308,"forks":582,"open_issues":308,"watchers":4730,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/1328"},"html":{"href":"https://github.com/hashicorp/consul/pull/1328"},"issue":{"href":"https://api.github.com/repos/hashicorp/consul/issues/1328"},"comments":{"href":"https://api.github.com/repos/hashicorp/consul/issues/1328/comments"},"review_comments":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/1328/comments"},"review_comment":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/1328/commits"},"statuses":{"href":"https://api.github.com/repos/hashicorp/consul/statuses/6c528f0ff25053ec9f968a349ac9fdea295735b7"}}}}