Organize Makefile variables and fix Go flags bug - #2520
Merged
Conversation
msscotb
reviewed
Sep 27, 2025
anmaxvl
approved these changes
Oct 1, 2025
Specifying Make variables via command line takes precedence over and overrides all assignments to it. This causes issues with `GO_FLAGS_EXTRA`, which may be updated to include `-tags` an `-mod` flags, as well as used to pass extra Go flags via command line (e.g., `make GO_FLAGS_EXTRA=-trimpath). Update `Makefile` to update `GO_FLAGS` instead, and leave `GO_FLAGS_EXTRA` unmodified. Move `Makefile` variables intended to be overridden in the command line to dedicated blocks, and add comments to them. Additionally, add fix for new Microsoft Go behavior (starting in go1.25) that requires CGo by default for crypto libraries. See: - https://www.gnu.org/software/make/manual/html_node/Overriding.html - https://github.com/microsoft/go/blob/microsoft/main/eng/doc/MigrationGuide.md#disabling-systemcrypto Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
anmaxvl
approved these changes
Oct 24, 2025
ambarve
reviewed
Oct 24, 2025
ambarve
approved these changes
Oct 24, 2025
ambarve
left a comment
Contributor
There was a problem hiding this comment.
One minor suggestion, but LGTM otherwise.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GO_FLAGS_EXTRAbehavior is bugged and cannot be used to pass extra Go flags to the build command.E.g.,
make GO_BUILD_TAGS=rego GO_FLAGS_EXTRA=-trimpath out/delta-snp.tar.gzbuilds the Go binaries with only the-trimpathflag, and not-tags=rego:Specifying Make variables via command line takes precedence over and overrides all assignments to it.
This causes issues with
GO_FLAGS_EXTRA, which may be updated to include-tagsan-modflags, as well as used to pass extra Go flags via command line (e.g.,make GO_FLAGS_EXTRA=-trimpath). UpdateMakefileto updateGO_FLAGSinstead, and leaveGO_FLAGS_EXTRAunmodified.Move
Makefilevariables intended to be overridden in the command line to dedicated blocks, and add comments to them.Additionally, add fix for new Microsoft Go behavior (starting in go1.25) that requires CGo by default for crypto libraries.
See: