From 8a0de7d5d782cd9f7e5673b1a470cbec3d157cb3 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Thu, 3 Sep 2026 19:22:23 +0200 Subject: [PATCH] build(makefile): disable two go fix modernizers that emit broken code go fix runs the modernize suite since Go 1.26, and two of its analyzers rewrite this codebase into code that does not compile, so make fmt broke the build and then make lint. CONTRIBUTING tells every contributor to run both before opening a PR. embedlit folded telemetryCfg.LogLevel into a literal that already set that key, and errorsastype rewrote errors.As to errors.AsType[HttpError] even though HttpError does not embed error. Disable both, with a TODO covering when each can come back. --- Makefile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index df9dcbac..30cf40cf 100644 --- a/Makefile +++ b/Makefile @@ -214,9 +214,20 @@ lint-prettier: ## Lint non-Golang codebase lint-todo: ## Find TODOs in Golang codebase golangci-lint run --no-config --disable-all --enable godox +# TODO: restore a plain "go fix ./..." once both modernizers stop rewriting this +# codebase into code that does not compile. Re-check by dropping a flag and +# running "make fmt && make lint". Removing an analyzer upstream makes go fix +# fail with "flag provided but not defined", so this cannot rot silently. +# embedlit folds a post-literal field assignment into a literal that already +# sets that key, producing a duplicate field name (cmd/gotenberg.go). Fixed in +# Go 1.27.1, so drop that flag once the toolchain moves past 1.27.0. +# See https://github.com/golang/go/issues/81101. +# errorsastype rewrites errors.As to errors.AsType[T] without checking that T +# satisfies error, which breaks on api.HttpError since it does not embed +# error. Still broken as of Go 1.27.1. .PHONY: fmt fmt: ## Format Golang codebase and "optimize" the dependencies - go fix ./... + go fix -embedlit=false -errorsastype=false ./... golangci-lint fmt go mod tidy