blob: a7059394d2f26eaf255bdfff6ecc6f57f61c301c (
plain)
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
27
28
29
30
|
# Helper functions to build go code in gitlab-shell
require 'fileutils'
# This will set the ROOT_PATH variable
require_relative '../lib/gitlab_init'
module GoBuild
GO_DIR = 'go'.freeze
BUILD_DIR = File.join(ROOT_PATH, 'go_build')
GO_ENV = {
'GOBIN' => File.join(BUILD_DIR, 'bin'),
'GO111MODULE' => 'on',
'GOPROXY' => 'https://proxy.golang.org'
}.freeze
def ensure_build_dir_exists
FileUtils.mkdir_p(BUILD_DIR)
end
def run!(env, cmd, options = {})
raise "env must be a hash" unless env.is_a?(Hash)
raise "cmd must be an array" unless cmd.is_a?(Array)
unless system(env, *cmd, options)
abort "command failed: #{env.inspect} #{cmd.join(' ')}"
end
end
end
|