From ed1137f27dbefffea7b754095884c626f4981ac1 Mon Sep 17 00:00:00 2001 From: David Michael Date: Tue, 7 May 2019 03:35:57 +0000 Subject: [PATCH] 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. --- .../third_party/coreos-overlay/eclass/coreos-go.eclass | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go.eclass b/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go.eclass index 57859ecf33..ffc1c29bf5 100644 --- a/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go.eclass +++ b/sdk_container/src/third_party/coreos-overlay/eclass/coreos-go.eclass @@ -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}"