From 264309e27fe5c0c4d9edc633f778fb2f987c180a Mon Sep 17 00:00:00 2001 From: Ingmar Stein <490610+IngmarStein@users.noreply.github.com> Date: Fri, 2 May 2025 07:48:25 +0200 Subject: [PATCH] Bump to Go 1.24.2 Fixes https://github.com/cloudflare/cloudflared/issues/1460. This required fixing new `go vet` findings: ``` tunnelrpc/pogs/configuration_manager.go:99:22: non-constant format string in call to fmt.Errorf tunnelrpc/pogs/session_manager.go:130:22: non-constant format string in call to fmt.Errorf ingress/ingress.go:116:20: non-constant format string in call to (*github.com/rs/zerolog.Event).Msgf ingress/origin_proxy.go:77:21: non-constant format string in call to (*github.com/rs/zerolog.Event).Msgf cmd/cloudflared/tunnel/subcommands.go:764:31: non-constant format string in call to github.com/cloudflare/cloudflared/cmd/cloudflared/cliutil.UsageError ``` --- cmd/cloudflared/tunnel/subcommands.go | 2 +- go.mod | 2 +- ingress/ingress.go | 2 +- ingress/origin_proxy.go | 2 +- tunnelrpc/pogs/configuration_manager.go | 4 ++-- tunnelrpc/pogs/session_manager.go | 3 ++- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cmd/cloudflared/tunnel/subcommands.go b/cmd/cloudflared/tunnel/subcommands.go index 1700b696..4be655a0 100644 --- a/cmd/cloudflared/tunnel/subcommands.go +++ b/cmd/cloudflared/tunnel/subcommands.go @@ -761,7 +761,7 @@ func runCommand(c *cli.Context) error { if tokenFile := c.String(TunnelTokenFileFlag); tokenFile != "" { data, err := os.ReadFile(tokenFile) if err != nil { - return cliutil.UsageError("Failed to read token file: " + err.Error()) + return cliutil.UsageError("Failed to read token file: %s", err.Error()) } tokenStr = strings.TrimSpace(string(data)) } diff --git a/go.mod b/go.mod index a5a24f1a..9fe4b2bc 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/cloudflare/cloudflared -go 1.22 +go 1.24.2 require ( github.com/coredns/coredns v1.11.3 diff --git a/ingress/ingress.go b/ingress/ingress.go index 60ee87ac..aa0e3127 100644 --- a/ingress/ingress.go +++ b/ingress/ingress.go @@ -113,7 +113,7 @@ func ParseIngressFromConfigAndCLI(conf *config.Configuration, c *cli.Context, lo // If no token is provided, the probability of NOT being a remotely managed tunnel is higher. // So, we should warn the user that no ingress rules were found, because remote configuration will most likely not exist. if !c.IsSet("token") { - log.Warn().Msgf(ErrNoIngressRulesCLI.Error()) + log.Warn().Msg(ErrNoIngressRulesCLI.Error()) } return newDefaultOrigin(c, log), nil } diff --git a/ingress/origin_proxy.go b/ingress/origin_proxy.go index 1caf28f0..489bdd96 100644 --- a/ingress/origin_proxy.go +++ b/ingress/origin_proxy.go @@ -74,7 +74,7 @@ func (o *httpService) SetOriginServerName(req *http.Request) { func (o *statusCode) RoundTrip(_ *http.Request) (*http.Response, error) { if o.defaultResp { - o.log.Warn().Msgf(ErrNoIngressRulesCLI.Error()) + o.log.Warn().Msg(ErrNoIngressRulesCLI.Error()) } resp := &http.Response{ StatusCode: o.code, diff --git a/tunnelrpc/pogs/configuration_manager.go b/tunnelrpc/pogs/configuration_manager.go index 4daae802..544ea0b5 100644 --- a/tunnelrpc/pogs/configuration_manager.go +++ b/tunnelrpc/pogs/configuration_manager.go @@ -2,7 +2,7 @@ package pogs import ( "context" - "fmt" + "errors" capnp "zombiezen.com/go/capnproto2" "zombiezen.com/go/capnproto2/rpc" @@ -96,7 +96,7 @@ func (p *UpdateConfigurationResponse) Unmarshal(s proto.UpdateConfigurationRespo return err } if respErr != "" { - p.Err = fmt.Errorf(respErr) + p.Err = errors.New(respErr) } return nil } diff --git a/tunnelrpc/pogs/session_manager.go b/tunnelrpc/pogs/session_manager.go index b5552983..5e3791c0 100644 --- a/tunnelrpc/pogs/session_manager.go +++ b/tunnelrpc/pogs/session_manager.go @@ -2,6 +2,7 @@ package pogs import ( "context" + "errors" "fmt" "net" "time" @@ -127,7 +128,7 @@ func (p *RegisterUdpSessionResponse) Unmarshal(s proto.RegisterUdpSessionRespons return err } if respErr != "" { - p.Err = fmt.Errorf(respErr) + p.Err = errors.New(respErr) } p.Spans, err = s.Spans() if err != nil {