coreos-go.eclass: Support setting the Go module download mode

Set COREOS_GO_MOD=vendor in the ebuild to use the project's vendor
directory to satisfy dependencies.  This variable should not be set
for projects that don't use Go modules.
This commit is contained in:
David Michael 2019-05-07 03:35:57 +00:00
parent 33dfb5126e
commit ed1137f27d

View File

@ -4,6 +4,15 @@
# @ECLASS: coreos-go.eclass
# @BLURB: utility functions for building Go binaries
# @ECLASS-VARIABLE: COREOS_GO_MOD
# @DESCRIPTION:
# Specify the module download mode for Go modules to use.
#
# Example:
# @CODE
# COREOS_GO_MOD=vendor
# @CODE
# @ECLASS-VARIABLE: COREOS_GO_PACKAGE
# @REQUIRED
# @DESCRIPTION:
@ -46,6 +55,7 @@ go_build() {
${EGO} build -v \
-p "$(makeopts_jobs)" \
-ldflags "${GO_LDFLAGS} -extldflags '${LDFLAGS}'" \
${COREOS_GO_MOD:+-mod "${COREOS_GO_MOD}"} \
-o "${GOBIN}/${binary_name}" \
"${package_name}"