Skip to content

Instantly share code, notes, and snippets.

@orip
Created September 11, 2019 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orip/aa0c472f8da03d3f9d764b7988bcf473 to your computer and use it in GitHub Desktop.
Save orip/aa0c472f8da03d3f9d764b7988bcf473 to your computer and use it in GitHub Desktop.
waf rule for building golang with modules and vendoring
#!/usr/bin/env python
# encoding: utf-8
# Sample binary target based on golang 1.11+ using modules and vendoring.
#
# To use:
# - Update the go binary path if not in /usr/local/go/bin
# - Remove '-mod=vendor' if not using vendoring
bld.program(
target = 'mytarget',
rule = 'cd ${SRC[0].parent.abspath()}; /usr/local/go/bin/go build -o ${TGT[0].abspath()} -mod=vendor',
source = bld.path.ant_glob(['**/*.go$', 'go.sum', 'go.mod']),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment