Add third-party license notices, generated and embedded in the binary
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:
1 parent
ee65e72c44
commit
0c88b4ffd5
19 files changed
+4969
-23
No files matched your search
@@ -1,10 +1,13 @@
|
||||
.PHONY: build test lint fmt fmt-check vet tidy tidy-check vuln openapi openapi-check release-check snapshot check run
|
||||
.PHONY: build test lint fmt fmt-check vet tidy tidy-check vuln generate generate-check release-check snapshot check run
|
||||
|
||||
# Without the leading v, as goreleaser's {{ .Version }} reports it.
|
||||
VERSION ?= $(patsubst v%,%,$(shell git describe --tags --always --dirty 2>/dev/null || echo dev))
|
||||
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo none)
|
||||
LDFLAGS := -s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT)
|
||||
|
||||
# The files go generate writes.
|
||||
GENERATED := docs/swagger.json THIRD-PARTY-LICENSES.md internal/app/uberbringer/licenses_embed.md
|
||||
|
||||
build:
|
||||
go build -trimpath -ldflags "$(LDFLAGS)" -o bin/ ./cmd/...
|
||||
|
||||
@@ -37,13 +40,15 @@ tidy-check:
|
||||
vuln:
|
||||
go tool govulncheck ./...
|
||||
|
||||
# Runs every go:generate directive, which writes docs/swagger.json.
|
||||
openapi:
|
||||
# Runs every go:generate directive, which writes docs/swagger.json,
|
||||
# THIRD-PARTY-LICENSES.md and the copy of it that the binary embeds.
|
||||
generate:
|
||||
go generate ./...
|
||||
|
||||
# Fails when docs/swagger.json differs from what the route table produces.
|
||||
openapi-check: openapi
|
||||
git diff --exit-code -- docs/swagger.json
|
||||
# Fails when a generated file differs from what the route table and the
|
||||
# linked modules produce.
|
||||
generate-check: generate
|
||||
git diff --exit-code -- $(GENERATED)
|
||||
|
||||
# Validates .goreleaser.yaml without building anything.
|
||||
release-check:
|
||||
@@ -57,7 +62,7 @@ snapshot:
|
||||
|
||||
# The gate .gitea/workflows/test.yml runs, in the same order.
|
||||
# .gitea/workflows/security.yml runs vuln.
|
||||
check: fmt-check tidy-check vet lint openapi-check test release-check
|
||||
check: fmt-check tidy-check vet lint generate-check test release-check
|
||||
|
||||
run:
|
||||
go run ./cmd/uberbringer --config config.toml
|
||||
Reference in new issue
Block a user