From 56db9d52a1d99f3de61b770ee696a3cdc97d6ded Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Sat, 6 Dec 2025 18:52:01 +0000 Subject: go-mod-discovery: support multi-patckage build When building multiple packages (./... or multiple targets), go build requires the output to be a directory. Create the directory and use it. Signed-off-by: Bruce Ashfield --- classes/go-mod-discovery.bbclass | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/go-mod-discovery.bbclass b/classes/go-mod-discovery.bbclass index 87cd9def..fc7c2008 100644 --- a/classes/go-mod-discovery.bbclass +++ b/classes/go-mod-discovery.bbclass @@ -205,7 +205,11 @@ Hint: Set GO_MOD_DISCOVERY_SRCDIR to the directory containing go.mod" BUILD_CMD="${BUILD_CMD} -tags \"${TAGS}\"" fi BUILD_CMD="${BUILD_CMD} -ldflags \"${GO_MOD_DISCOVERY_LDFLAGS}\"" - BUILD_CMD="${BUILD_CMD} -o \"${GO_MOD_DISCOVERY_OUTPUT}\" ${GO_MOD_DISCOVERY_BUILD_TARGET}" + + # When building multiple packages (./... or multiple targets), go build + # requires the output to be a directory. Create the directory and use it. + mkdir -p "${GO_MOD_DISCOVERY_OUTPUT}" + BUILD_CMD="${BUILD_CMD} -o \"${GO_MOD_DISCOVERY_OUTPUT}/\" ${GO_MOD_DISCOVERY_BUILD_TARGET}" echo "Executing: ${BUILD_CMD}" eval ${BUILD_CMD} -- cgit v1.2.3-54-g00ecf