From a2c6c48b667591b583b19c6c0b4d30f30e046ea4 Mon Sep 17 00:00:00 2001 From: Chris Bandy Date: Mon, 28 Oct 2024 12:21:34 -0500 Subject: [PATCH] Move CGO requirement to the effected code Forcing `CGO_ENABLED=1` in the Makefile is too far away from the reason we do it. Use a build constraint instead with a comment and link. See: 67fe735519a5cbc6cbd5f7ef3470340f5a560656 --- Makefile | 2 +- internal/postgres/users.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b49d64704..345761f52 100644 --- a/Makefile +++ b/Makefile @@ -145,7 +145,7 @@ deploy-dev: createnamespaces ##@ Build - Binary .PHONY: build-postgres-operator build-postgres-operator: ## Build the postgres-operator binary - CGO_ENABLED=1 $(GO_BUILD) $(\ + $(GO_BUILD) $(\ ) --ldflags '-X "main.versionString=$(PGO_VERSION)"' $(\ ) --trimpath -o bin/postgres-operator ./cmd/postgres-operator diff --git a/internal/postgres/users.go b/internal/postgres/users.go index be8785a4e..b7e351cd5 100644 --- a/internal/postgres/users.go +++ b/internal/postgres/users.go @@ -2,6 +2,9 @@ // // SPDX-License-Identifier: Apache-2.0 +// [pg_query.Parse] requires CGO to compile and call https://github.com/pganalyze/libpg_query +//go:build cgo + package postgres import (