mirror of
https://github.com/k8snetworkplumbingwg/multus-cni.git
synced 2025-09-19 08:25:18 +00:00
build: Enable -mod build flag to be toggled via environment variable
This change will enable builds to be performed with the option of passing the -mod flag to 'go build'. This can be done by optionally setting the MODMODE environment variable prior to building. For example, toggling the -mod setting for the build can be accomplished as follows: ``` $ MODMODE=vendor ./build ``` Signed-off-by: Ryan Tidwell <rtidwell@suse.com>
This commit is contained in:
6
build
6
build
@@ -44,7 +44,11 @@ if [ "$GO111MODULE" == "off" ]; then
|
||||
else
|
||||
# build with go modules
|
||||
export GO111MODULE=on
|
||||
BUILD_ARGS=(-o ${DEST_DIR}/multus -tags no_openssl)
|
||||
if [ -n "$MODMODE" ]; then
|
||||
BUILD_ARGS+=(-mod "$MODMODE")
|
||||
fi
|
||||
|
||||
echo "Building plugins"
|
||||
go build -o ${DEST_DIR}/multus -tags no_openssl -ldflags "${LDFLAGS}" "$@" ./multus
|
||||
go build ${BUILD_ARGS[*]} -ldflags "${LDFLAGS}" "$@" ./multus
|
||||
fi
|
||||
|
Reference in New Issue
Block a user