Repository navigation
Make the dependency license list deterministic - #896
Merged
Merged
Conversation
go-licenses' default report resolves the second column, a link to each license file, over the network. The lookup decides whether a module's major version directory is part of its repository, so the same inputs produce different output run to run: the `vN/LICENSE` form when it succeeds, the repository root form when it fails, and `Unknown` when the module is not on a known host. CI compares the committed CSV byte for byte, so `make lint` and the smoke test fail at random, on whichever PR happens to run when a shared runner is throttled. The `vN/LICENSE` form that a successful lookup produces does not exist: both URLs the file currently carries return 404. That is google/go-licenses#131, open and unfixed in v2.0.1, the latest release. Report through a template instead, and put the module version in that column. go-licenses takes the version from the module graph, so it needs no network and cannot drift. The module and license columns are byte-identical to before, and the version is more useful for license review than a link that may not resolve. Verified the report is identical across repeated runs and with the network blocked.
Contributor
Author
|
@HoustonPutman This has been an issue for a few years but we have not encountered it before due to not updating the file very often. And it's a flaky condition that most often would be fixed with a CI check re-run. But that's annoying so if we sacrifice the URLs as proposed, at least we'd get a stable check, but you'd need to find the license URL yourself based on module and version. |
HoustonPutman
approved these changes
Nov 9, 2026
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.
🤖 AI assisted 🤖
Problem
make lintand the smoke test fail at random oncheck-licenses, on whichever PR runs while a shared runner is throttled. #889 passed at 00:30 and failed at 08:07 with no dependency change in between, and an unrelated branch failed in the same window on the same two rows.go-licenses reportresolves the second column, the link to each license file, over the network: for a major version above v1 it probes the remote to tell the "major branch" and "major subdirectory" conventions apart. Running the current command four ways gives three different answers for that row,.../v2/LICENSEwhen the probe succeeds,.../LICENSEorUnknownwhen it fails. Only two dependencies can move, the two whose license file sits at the repository root rather than beside thego.mod.The answer a successful probe gives is the wrong one, so the link in the file today is dead:
And not only those two. Checking all 78 URLs in the file, 13 are dead: the other 11 are
go-openapi/swagsubmodules, wrong the same way but consistently rather than intermittently, so they have never broken CI. The column has been 17% dead links.Upstream #73 has the analysis and #131 the resulting 404s, both open: the Go module cache copies a repository-root LICENSE into a nested module that lacks one, so the tool finds it at the module root and guesses a path that was never there. Not new to us either, the bad URL has been in the file since the v1.5.0 bump in November 2022.
Solution
Render the report through
--template, a documented go-licenses flag, and put the module version in that column instead of the link. The version comes from the module graph, so it needs no network and cannot drift.The report now hashes identically across repeated runs, with the network blocked, and against the committed file. No license data changes: same 78 rows, and
diff <(cut -d, -f1,3 old) <(cut -d, -f1,3 new)is empty. TheGOOS=linux GOARCH=amd64prefix is untouched, so the list still reflects the Linux build graph.Rejected alternatives
make preparestill rewrites them.pkg.go.devlink. Tried it; the template exposes the package path, not the module path, so threek8s.io/kube-openapientries came out as 404s.