-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
fix: build with go 1.23 by tracking modules.txt #168
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it locally and it indeed works with go 1.23.
I checked why the unit test for the cli-args fails and the situation is somewhat complicated.
and so the resulting
This is absolutely correct. If you run
So, how to fix this? I think ultimately we would need to bring the environment that generates the |
I tested this branch, and it seems it broke the
|
8d0a797
to
928f240
Compare
Fixes: nix-community#117 Since go 1.23, `vendor/modules.txt` is [required](golang/go@38ee0c7#diff-61fb6e44eac25bd4d6a8a64b3f38ee8a41faaefd1ef481170a011ecfc0f7c76bR344). Hence, this is a first attempt to track `modules.txt` via gomod2nix. Since, unfortunately, `module.txt` employs a bespoke custom format in which [varying](https://cs.opensource.google/go/go/+/refs/tags/go1.23.0:src/cmd/go/internal/modload/vendor.go;l=57) [numbers](https://cs.opensource.google/go/go/+/refs/tags/go1.23.0:src/cmd/go/internal/modload/vendor.go;l=103) of `#` hold meaning I deemed it more stable to not reverse engineer it. Instead, we generate it when running `gomod2nix` by executing `go mod vendor` and tracking its content in `gomod2nix.toml`. Not the most elegant solution, but it works and enables us to use gomod2nix with go v1.23. Any comments appreached…
2e06536
to
3668e43
Compare
have been using this branch for a while, seems working fine 👍 |
Ran the following to fix the nix build ``` nix flake update go mod tidy go run . generate nix build ```
@obreitwi I think I fixed the nix build which should help the CI pass here if you merge my PR into your branch that this PR is based on. |
For more readable diffs it would be nice if the generated vendor modules txt was using a multiline |
nix: fix build
While I also prefer it, this would require a change of |
Oh, I throught it was already supported when looking at this comment: |
|
Can confirm (didn't see your edit beforehand). I think in the end it comes down to switching to another toml encoder (or contributing the functionality upstream). |
There are a number of issues and PRs turning up related to this. Given the length of time the toml package has had a fix for the multi line pending in it's large rewrite branch, it seems like the toml package will not be released anytime soon. Switching to another toml package might be better done in another PR first, but would be easier if using at least a go version that is in stable nixpkgs, e.g. go_1_22. What needs to be done to get this merged? |
Fixes: #117
Since go 1.23,
vendor/modules.txt
is required.Hence, this is a first attempt to track
modules.txt
via gomod2nix.Since, unfortunately,
module.txt
employs a bespoke custom format in whichvarying numbers of
#
hold meaning, I deemed it more stable to not reverse-engineer it.Instead, we generate it when running
gomod2nix
by executinggo mod vendor
and tracking its content ingomod2nix.toml
.Not the most elegant solution, but it works and enables us to use gomod2nix with go v1.23.
Any comments appreached…