From 5c1e44dcffa47929b401a9e8671f2f306ca6fb7f Mon Sep 17 00:00:00 2001 From: SuperQ Date: Sun, 27 Sep 2026 14:46:16 +0200 Subject: [PATCH] Update linting * Update golangci-lint to match upstream Prometheus. * Enable nolintlint now that the issue is fixed. * Migrate deprecated gofumpt config. * Fixup deprecated http2 API. Signed-off-by: SuperQ --- .golangci.yml | 6 +++--- Makefile.common | 5 +++++ config/http_config.go | 10 ++++------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 8c9c0001..e4f597a9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -13,8 +13,7 @@ linters: - misspell - modernize - nilnesserr - # TODO(bwplotka): Enable once https://github.com/golangci/golangci-lint/issues/3228 is fixed. - # - nolintlint + - nolintlint - perfsprint - predeclared - revive @@ -178,7 +177,8 @@ formatters: - prefix(github.com/prometheus/common) gofumpt: module-path: github.com/prometheus/common - extra-rules: true + extra: + group-params: true goimports: local-prefixes: - github.com/prometheus/common diff --git a/Makefile.common b/Makefile.common index 85a36f6d..5e0edd1a 100644 --- a/Makefile.common +++ b/Makefile.common @@ -247,6 +247,11 @@ common-docker-repo-name: .PHONY: common-docker $(BUILD_DOCKER_ARCHS) common-docker: $(BUILD_DOCKER_ARCHS) + +.PHONY: common-docker-current-arch +common-docker-current-arch: + $(MAKE) common-docker-$(GOHOSTARCH) + # DOCKER_ARCHS holds promu architecture names, which are not OCI platform strings. $(BUILD_DOCKER_ARCHS): common-docker-%: @for variant in $(DOCKERFILE_VARIANTS_WITH_NAMES); do \ diff --git a/config/http_config.go b/config/http_config.go index 8c8f1c7c..b8224270 100644 --- a/config/http_config.go +++ b/config/http_config.go @@ -37,7 +37,6 @@ import ( "github.com/mwitkow/go-conntrack" "go.yaml.in/yaml/v2" "golang.org/x/net/http/httpproxy" - "golang.org/x/net/http2" "golang.org/x/oauth2" "golang.org/x/oauth2/clientcredentials" ) @@ -665,11 +664,10 @@ func NewRoundTripperFromConfigWithContext(ctx context.Context, cfg HTTPClientCon DialContext: dialContext, } if opts.http2Enabled && cfg.EnableHTTP2 { - http2t, err := http2.ConfigureTransports(rt.(*http.Transport)) - if err != nil { - return nil, err - } - http2t.ReadIdleTimeout = time.Minute + rt.(*http.Transport).Protocols = &http.Protocols{} + rt.(*http.Transport).Protocols.SetHTTP1(true) + rt.(*http.Transport).Protocols.SetHTTP2(true) + rt.(*http.Transport).HTTP2 = &http.HTTP2Config{SendPingTimeout: time.Minute} } // If a authorization_credentials is provided, create a round tripper that will set the