fix: Handle architecture-specific license dependencies - #1581
Merged
Conversation
The licenses script now: - Generates separate license reports per GOOS/GOARCH combination - Groups identical reports together (comma-separated arch names) - Adds a Table of Contents at the top of each platform file - Handles cases where different architectures have different dependencies (e.g., x/sys/unix vs x/sys/windows, mousetrap on Windows only) This addresses the issue discovered in cli/cli where some deps changed which changed the mod graph for different GOARCH and affected the exported licenses because go-licenses tries to find common ancestors.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the license generation script to properly handle architecture-specific dependency differences across GOOS/GOARCH combinations. The script now generates separate reports per architecture, groups identical results with comma-separated headers, and adds a table of contents to each platform file.
Key changes:
- Multi-architecture license generation for Linux (amd64, arm64, 386), Darwin (amd64, arm64), and Windows (amd64, arm64, 386)
- Grouping logic that consolidates architectures with identical dependency lists
- Automated table of contents generation with anchor links
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| script/licenses | Complete rewrite to support multi-architecture license generation with grouping logic, TOC generation, and per-arch report handling |
| third-party-licenses.linux.md | Restructured with TOC and architecture sections; packages reordered alphabetically |
| third-party-licenses.darwin.md | Restructured with TOC and architecture sections; packages reordered alphabetically |
| third-party-licenses.windows.md | Restructured with TOC and architecture sections; packages reordered alphabetically |
Summary
This PR improves the license script to handle architecture-specific dependency differences. Some dependencies have different module graphs for different GOARCH values (e.g.,
x/sys/cpuvsx/sys/unix), which can result in different licenses being exported per architecture.Problem
As discovered in github/cli, some deps change which changes the mod graph for different GOARCH values. For example:
amd64might havex/sys/cpuandx/sys/unixso the common ancestor isx/sysarm64might just havex/sys/unixso the common ancestor isx/sys/unixThis means license reports can differ between architectures on the same platform.
Solution
Updated
script/licensesto:Changes
script/licenses: Enhanced to handle multi-architecture license generation with groupingthird-party-licenses.*.md: Updated with architecture sections and indexthird-party/: Contains architecture-specific license foldersExample Output
When all architectures have the same deps:
When architectures differ: