Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildGoModule: warn about buildFlags only when using buildPhase provided by buildGoModule #298847

Merged
merged 2 commits into from
May 3, 2024

Conversation

ShamrockLee
Copy link
Contributor

@ShamrockLee ShamrockLee commented Mar 25, 2024

Description of changes

The warning that suggests using ldflags instdead of buildFlags or buildFlagsArray is relevant only when buildPhase provided by buildGoModule. It becomes annoying if developers specifies a Make-based build phase and try to use buildFlags there.

This PR fixes this issue by attaching the warning to the buildPhase implementation by buildGoModule. If applied, the warning won't be triggered if buildPhase is specified otherwise, during packaging or overriding.

This PR also moves GOFLAGS-related warnings where the attribute GOFLAGS is specified. This clears away the remaining "global" warnings, simplifying the work to fix overriding and adopt fixed-point arguments.

Things done

  • Built on platform(s)
    • x86_64-linux (no rebuild)
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

Copy link
Contributor

@katexochen katexochen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! Looks good to me.

Warn about buildFlags and ldflags only when using buildPhase provided by
buildGoModule.

This allows developers to use buildFlags in custom buildPhase.
…ation

Avoid "global" warnings that complicates fixed-point arguments support.
@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Apr 18, 2024

Bump onto master and resolve merge conflicts. (Cc: @wegank )

Add a commit that moves GOFLAGS-related warnings where the specification is made.

@katexochen Could you help me take a look again?

@ShamrockLee
Copy link
Contributor Author

@ofborg build gojq
@ofborg build apptainer

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/3842

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-already-reviewed/2617/1608

@kalbasit kalbasit merged commit 7c4cc64 into NixOS:master May 3, 2024
32 checks passed
@wegank
Copy link
Member

wegank commented May 3, 2024

This would have merge conflicts with #279391 on staging (fixed)

@katexochen
Copy link
Contributor

Sorry @wegank , missed that. Let me know if you need an additional pair of eyes on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants