Skip to content
Snippets Groups Projects

Add hello-world Go executable and gitaly-proto 0.5.0

Merged Jacob Vosmaer (GitLab) requested to merge go-hello-world into master
All threads resolved!
Files
15+
bin/compile 0 → 100755
+ 36
0
#!/usr/bin/env ruby
require 'fileutils'
# This will set the ROOT_PATH variable
require_relative '../lib/gitlab_init'
GO_DIR = 'go'
BUILD_DIR = File.join(ROOT_PATH, 'go_build')
GO_PACKAGE = File.join('gitlab.com/gitlab-org/gitlab-shell', GO_DIR)
def main
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)
env = {
'GOPATH' => BUILD_DIR,
'GO15VENDOREXPERIMENT' => '1',
}
run!(env, %W[go install #{GO_PACKAGE}/cmd/...])
executables = Dir[File.join(BUILD_DIR, 'bin', '*')]
FileUtils.chmod(0755, executables)
FileUtils.cp(executables, File.join(ROOT_PATH, 'bin'))
end
def run!(env, cmd)
raise "env must be a hash" unless env.is_a?(Hash)
raise "cmd must be an array" unless cmd.is_a?(Array)
if !system(env, *cmd)
abort "command failed: #{env.inspect} #{cmd.join(' ')}"
end
end
main
Loading