File tree 3 files changed +22
-4
lines changed
3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -8,3 +8,7 @@ arguments:
8
8
description : " Use non-deprecated protobuf modules for Go"
9
9
schema :
10
10
type : boolean
11
+ enableCgo :
12
+ description : " Enables compiling Go binaries with cgo."
13
+ schema :
14
+ type : boolean
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ TAGS :=
28
28
BINDIR := $(CURDIR ) /bin
29
29
BIN_NAME := $(APP )
30
30
PKGDIR := github.com/$(ORG ) /$(APP )
31
- CGO_ENABLED ?= 1
31
+ CGO_ENABLED ?= $( shell " $( CURDIR ) /scripts/shell-wrapper.sh cgo-enabled.sh")
32
32
TOOL_DEPS := ${GO}
33
33
34
34
# formatters / misc
@@ -177,13 +177,13 @@ run:: pre-run build
177
177
# # devspace-watch: watch source files and build them for linux. To be used with devspace using `devenv apps run --sync-binaries .`
178
178
.PHONY : devspace-watch
179
179
devspace-watch :
180
- @DEVBOX_LOGFMT=" $( LOGFMT) " BUILD_FOR_GOOS=" linux" CGO_ENABLED=0 SKIP_TRIMPATH=" true" SKIP_STARTING_APP=" true" DLV_PORT=42097 $(AIR )
180
+ @DEVBOX_LOGFMT=" $( LOGFMT) " BUILD_FOR_GOOS=" linux" CGO_ENABLED=$( CGO_ENABLED ) SKIP_TRIMPATH=" true" SKIP_STARTING_APP=" true" DLV_PORT=42097 $(AIR )
181
181
182
182
# # devspace: build sources for linux with debugging symbols. To be used with devspace using `devenv apps run --sync-binaries .`
183
183
.PHONY : devspace
184
184
devspace :
185
- @DEVBOX_LOGFMT=" $( LOGFMT) " BUILD_FOR_GOOS=" linux" CGO_ENABLED=0 SKIP_TRIMPATH=" true" SKIP_STARTING_APP=" true" DLV_PORT=42097 $(MAGE_CMD ) gobuild
186
- @DEVBOX_LOGFMT=" $( LOGFMT) " BUILD_FOR_GOOS=" linux" CGO_ENABLED=0 $(MAGE_CMD ) e2etestbuild
185
+ @DEVBOX_LOGFMT=" $( LOGFMT) " BUILD_FOR_GOOS=" linux" CGO_ENABLED=$( CGO_ENABLED ) SKIP_TRIMPATH=" true" SKIP_STARTING_APP=" true" DLV_PORT=42097 $(MAGE_CMD ) gobuild
186
+ @DEVBOX_LOGFMT=" $( LOGFMT) " BUILD_FOR_GOOS=" linux" CGO_ENABLED=$( CGO_ENABLED ) $(MAGE_CMD ) e2etestbuild
187
187
@echo " Use 'devenv apps run --sync-binaries .' to sync binaries to devspace pod"
188
188
189
189
# # dev: run the service
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ # This is a small script to determine whether a service manifest has
3
+ # explicitly enabled compiling with CGo, and print out the appropriate
4
+ # value for the CGO_ENABLED environment variable. Defaults to disabled.
5
+
6
+ DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd) "
7
+ # shellcheck source=./lib/bootstrap.sh
8
+ source " $DIR /lib/bootstrap.sh"
9
+
10
+ if [[ " $( yq -r " .arguments.enableCgo" < " $( get_service_yaml) " ) " == " true" ]]; then
11
+ echo " 1"
12
+ else
13
+ echo " 0"
14
+ fi
You can’t perform that action at this time.
0 commit comments