summaryrefslogtreecommitdiff
path: root/support/go-update-vendor
diff options
context:
space:
mode:
authorJacob Vosmaer (GitLab) <jacob@gitlab.com>2018-07-24 13:17:52 +0000
committerRémy Coutable <remy@rymai.me>2018-07-24 13:17:52 +0000
commitbcff3f3bb431c013000c83b6fce8f228429cf0d8 (patch)
tree84ac83633d1029b9ce3400714e16f6220ee3a3a0 /support/go-update-vendor
parentf59cd678e22c02a8f5a474bb982c22cdde0134c1 (diff)
downloadgitlab-shell-bcff3f3bb431c013000c83b6fce8f228429cf0d8.tar.gz
Add script to update vendored go libs
Diffstat (limited to 'support/go-update-vendor')
-rwxr-xr-xsupport/go-update-vendor26
1 files changed, 26 insertions, 0 deletions
diff --git a/support/go-update-vendor b/support/go-update-vendor
new file mode 100755
index 0000000..020bb87
--- /dev/null
+++ b/support/go-update-vendor
@@ -0,0 +1,26 @@
+#!/usr/bin/env ruby
+
+require 'fileutils'
+
+require_relative 'go_build'
+include GoBuild
+
+def main(dependency)
+ # Govendor wants to run in a GOPATH so let's make one for it.
+ create_fresh_build_dir
+ run!(GO_ENV, %w[go get github.com/kardianos/govendor])
+
+ gitlab_shell_build_go_dir = File.join(BUILD_DIR, 'src', GO_PACKAGE)
+ run!(GO_ENV, %W[govendor fetch #{dependency}], chdir: gitlab_shell_build_go_dir)
+
+ # Now we have updated go/vendor in the temporary build dir. We must sync
+ # the changes back so that Git will see them.
+ FileUtils.rm_rf('go/vendor')
+ FileUtils.cp_r(File.join(gitlab_shell_build_go_dir, 'vendor'), 'go')
+end
+
+unless ARGV.count == 1
+ abort "usage: #{$PROGRAM_NAME} DEPENDENCY"
+end
+
+main(ARGV.first)