diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2019-08-19 05:02:05 +0000 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2019-08-19 05:02:05 +0000 |
commit | 256c97066bb7838d43798b6760d3acbb82c44263 (patch) | |
tree | a11de1a5bb9a3c27bcd6c9b31c0663bd91c5c8c8 /support/go_build.rb | |
parent | 81f5854513a527c3a00398e91930a12ebad70272 (diff) | |
parent | 4d330cb1dd0fa2d6470d459fc33a987e8f550887 (diff) | |
download | gitlab-shell-256c97066bb7838d43798b6760d3acbb82c44263.tar.gz |
Merge branch 'jv-go-mod' into 'master'
Use go mod
See merge request gitlab-org/gitlab-shell!323
Diffstat (limited to 'support/go_build.rb')
-rw-r--r-- | support/go_build.rb | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/support/go_build.rb b/support/go_build.rb index d11cc38..1ef2e17 100644 --- a/support/go_build.rb +++ b/support/go_build.rb @@ -8,19 +8,22 @@ require_relative '../lib/gitlab_init' module GoBuild GO_DIR = 'go'.freeze BUILD_DIR = File.join(ROOT_PATH, 'go_build') - GO_PACKAGE = File.join('gitlab.com/gitlab-org/gitlab-shell', GO_DIR) GO_ENV = { - 'GOPATH' => BUILD_DIR, - 'GO15VENDOREXPERIMENT' => '1', - 'GO111MODULE' => 'off' + # $GOBIN controls where 'go install' puts binaries. Prior to go mod, + # this was $GOPATH/bin. + 'GOBIN' => File.join(BUILD_DIR, 'bin'), + # Force the use of go mod, even if $GOPATH is set. + 'GO111MODULE' => 'on', + # Downloading dependencies via proxy.golang.org is faster and more + # reliable than downloading from canonical sources. We need this + # environment variable because as of Go 1.12, the default is still to + # download from canonical sources. + 'GOPROXY' => 'https://proxy.golang.org' }.freeze - def create_fresh_build_dir - FileUtils.rm_rf(BUILD_DIR) - build_source_dir = File.join(BUILD_DIR, 'src', GO_PACKAGE) - FileUtils.mkdir_p(build_source_dir) - FileUtils.cp_r(File.join(ROOT_PATH, GO_DIR, '.'), build_source_dir) + def ensure_build_dir_exists + FileUtils.mkdir_p(BUILD_DIR) end def run!(env, cmd, options = {}) |