File: go-update-vendor

package info (click to toggle)
gitlab-shell 8.4.3%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,468 kB
  • sloc: ruby: 3,812; sh: 82; makefile: 60
file content (26 lines) | stat: -rwxr-xr-x 729 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)