Class: Go::Build

Inherits:
Object
  • Object
show all
Defined in:
lib/scripts/go/build.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.descriptionObject



4
5
6
7
8
# File 'lib/scripts/go/build.rb', line 4

def description
  "    Builds go binary using gox which enables parallel builds\n  MARKDOWN\nend\n"

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/scripts/go/build.rb', line 11

def run
  command("go", "get", "github.com/mitchellh/gox")

  build_command = ["gox"]

  build_command = add_option("ldflags", build_command)

  parallel = env_fetch("GO_BUILD_PARALLEL", "2")
  build_command.push("-parallel")
  build_command.push(parallel)

  build_command = add_option("osarch", build_command)
  build_command = add_option("output", build_command)

  if gox_args = env_fetch("GO_BUILD_ARGS")
    build_command.concat(gox_args.split)
  end

  command(*build_command)
end