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

goimports from gotools seems to depend on go at runtime in some cases. #390770

Merged
merged 1 commit into from
Mar 22, 2025

Conversation

jaredmontoya
Copy link
Contributor

@jaredmontoya jaredmontoya commented Mar 17, 2025

Added go to goimports PATH

Here is the issue that lead to creation of this PR: numtide/treefmt-nix#318 (it has an example and reproduction instructions)

This was not the case before and if you know what exactly happened to goimports after an update and a better way to implement a fix let me know.

Things done

  • Built on platform(s)
    • x86_64-linux
    • 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/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 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.

@gabyx
Copy link
Contributor

gabyx commented Mar 18, 2025

I actually asked in NixOs Matrix chat about this, and the consensus was that gotools cannot know the go version, thats why this PR is probably not ideal. But I am unsure as well. Otherwise it looks good.

@jaredmontoya
Copy link
Contributor Author

jaredmontoya commented Mar 18, 2025

I did not think of what can happen if go package is updated and goimports in gotools changes behavior, because nobody does when they use wrapProgram in other packages.

Any dependency added with wrapProgram to any package can be updated and change behavior of other programs that depend on it.

If someone can solve this problem upstream(in nixpkgs) better, I am all for it.
Suggestions to the PR are also welcome.

@gabyx
Copy link
Contributor

gabyx commented Mar 20, 2025

Maybe @SuperSandro2000 knows more about it. I think it possible to override the runtime go package in this derivation if we need something else.

Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

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

goimports shouldn't care to much about the version but most other tools do and sometimes the diagnostics are even based on the available go.

@gabyx
Copy link
Contributor

gabyx commented Mar 22, 2025

@SuperSandro2000 thanks, so then that PR is good to go. Thanks @jaredmontoya!

@SuperSandro2000 SuperSandro2000 merged commit fc68877 into NixOS:master Mar 22, 2025
27 checks passed
@jaredmontoya jaredmontoya deleted the fix-goimports branch March 23, 2025 11:17
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.

3 participants