Compare commits

...

2 Commits

Author SHA1 Message Date
Julien Neuhart
430ed38cc5 build(makefile): re-enable the embedlit go fix modernizer 2026-09-11 16:13:06 +02:00
Julien Neuhart
623e93bf3e chore(deps): update Go to 1.27.1 2026-09-11 16:13:06 +02:00
5 changed files with 21 additions and 32 deletions

View File

@@ -219,20 +219,17 @@ lint-prettier: ## Lint non-Golang codebase
lint-todo: ## Find TODOs in Golang codebase
golangci-lint run --no-config --default=none --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.
# TODO: restore a plain "go fix ./..." once the errorsastype modernizer stops
# rewriting this codebase into code that does not compile. Re-check by dropping
# the flag and running "make fmt && make lint". Removing the analyzer upstream
# makes go fix fail with "flag provided but not defined", so this cannot rot
# silently.
# 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 -embedlit=false -errorsastype=false ./...
go fix -errorsastype=false ./...
golangci-lint fmt
go mod tidy

View File

@@ -1,7 +1,7 @@
# ARG instructions do not create additional layers. Instead, next layers will
# concatenate them. Also, we have to repeat ARG instructions in each build
# stage that uses them.
ARG GOLANG_VERSION=1.27.0
ARG GOLANG_VERSION=1.27.1
# ----------------------------------------------
# pdfcpu binary build stage

2
go.mod
View File

@@ -1,6 +1,6 @@
module github.com/gotenberg/gotenberg/v8
go 1.27.0
go 1.27.1
require (
github.com/alexliesenfeld/health v0.8.1

View File

@@ -201,17 +201,13 @@ func TestNewServerRecordMetrics(t *testing.T) {
server.RecordMetrics(t.Context(), semconv.ServerMetricData{
ServerName: "stuff",
ResponseSize: 200,
MetricAttributes: semconv.MetricAttributes{
Req: req,
StatusCode: 301,
AdditionalAttributes: []attribute.KeyValue{
attribute.String("key", "value"),
},
},
MetricData: semconv.MetricData{
RequestSize: 100,
ElapsedTime: 300,
Req: req,
StatusCode: 301,
AdditionalAttributes: []attribute.KeyValue{
attribute.String("key", "value"),
},
RequestSize: 100,
ElapsedTime: 300,
})
rm := metricdata.ResourceMetrics{}

View File

@@ -355,17 +355,13 @@ func telemetryMiddleware(logger *slog.Logger, serverName, correlationIdHeader st
}
semconvSrv.RecordMetrics(ctx, semconvutil.ServerMetricData{
ServerName: serverName,
ResponseSize: c.Response().Size,
MetricAttributes: semconvutil.MetricAttributes{
Req: request,
StatusCode: status,
AdditionalAttributes: additionalAttributes,
},
MetricData: semconvutil.MetricData{
RequestSize: request.ContentLength,
ElapsedTime: float64(time.Since(startTime)) / float64(time.Millisecond),
},
ServerName: serverName,
ResponseSize: c.Response().Size,
Req: request,
StatusCode: status,
AdditionalAttributes: additionalAttributes,
RequestSize: request.ContentLength,
ElapsedTime: float64(time.Since(startTime)) / float64(time.Millisecond),
})
return nil