Add third-party license notices, generated and embedded in the binary
Security / Vulnerability check (push) Successful in 44s
Test / Lint and test (push) Successful in 2m5s

THIRD-PARTY-LICENSES.md holds the license and notice files of the Go
distribution and of the 35 modules that ./cmd/uberbringer links on
linux amd64, armv6, armv7 and arm64, as each distribution ships them.
tools/genlicenses writes it on go generate from go list -deps, so
modules only the tools and tests use stay out. Beside each module's
root license it takes NOTICE files and the license files in its linked
packages' directories, which cover vendored code in gofiber/utils,
klauspost/compress and fasthttp. Each module is listed with its
version, so any dependency change needs the file regenerated. The
generator fails on a module with no license file or a license it does
not recognize.

The same text goes to internal/app/uberbringer/licenses_embed.md, which
the binary embeds and the new `uberbringer licenses` command prints.
The release archives carry the file, and the Docker image keeps it with
LICENSE.txt in /usr/share/licenses/uberbringer/.

The Makefile's openapi and openapi-check targets become generate and
generate-check. They, the CI step and the gate in CLAUDE.md check
docs/swagger.json and both license files, and a test fails when a
committed copy is out of date.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
57_WolveandClaude Opus 5.5 committed 2026-11-30 21:58:39 -06:00
1 parent ee65e72c44
commit 0c88b4ffd5
19 files changed
+4969 -23

No files matched your search

+1
View File
@@ -80,6 +80,7 @@ func newRootCommand(build BuildInfo) *cobra.Command {
newTokenCommand(&configPath),
newPreviewCommand(&configPath),
newConfigCommand(&configPath),
newLicensesCommand(),
)
return root
}
+15
View File
@@ -79,6 +79,21 @@ func TestVersionCommand(t *testing.T) {
}
}
func TestLicensesCommand(t *testing.T) {
out, err := runCommand(t, "licenses")
if err != nil {
t.Fatal(err)
}
if out != thirdPartyLicenses {
t.Error("licenses output differs from the embedded notices")
}
for _, want := range []string{"# Third-party licenses", "## Go standard library and runtime", "## github.com/spf13/cobra "} {
if !strings.Contains(out, want) {
t.Errorf("licenses output lacks %q", want)
}
}
}
func TestSecretCommand(t *testing.T) {
out, err := runCommand(t, "secret")
if err != nil {
+31
View File
@@ -0,0 +1,31 @@
package uberbringer
import (
_ "embed" // for the go:embed directive below
"io"
"github.com/spf13/cobra"
)
// thirdPartyLicenses is a copy of THIRD-PARTY-LICENSES.md, written beside
// this file by tools/genlicenses: the licenses and notices of the Go
// distribution and the modules linked into the binary. It must not be
// modified.
//
//go:embed licenses_embed.md
var thirdPartyLicenses string
func newLicensesCommand() *cobra.Command {
return &cobra.Command{
Use: "licenses",
Short: "Prints the licenses of the third-party software in the binary.",
Long: "Prints the licenses and notices of the Go standard library and the Go modules\n" +
"built into the binary, as Markdown. Überbringer itself is licensed under the\n" +
"EUPL-1.2.",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, _ []string) error {
_, err := io.WriteString(cmd.OutOrStdout(), thirdPartyLicenses)
return err
},
}
}
File diff suppressed because it is too large. Load diff