Update to go1.22

Co-authored-by: Julien Salleyron <julien.salleyron@gmail.com>
This commit is contained in:
Ludovic Fernandez 2024-02-07 17:14:07 +01:00 committed by GitHub
parent e11ff98608
commit d5cb9b50f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
56 changed files with 4189 additions and 3419 deletions

View file

@ -2,7 +2,7 @@ package server
import (
"context"
"fmt"
"errors"
"strconv"
"sync"
"testing"
@ -30,7 +30,7 @@ func (p *mockProvider) Provide(configurationChan chan<- dynamic.Message, _ *safe
}
if len(p.messages) == 0 {
return fmt.Errorf("no messages available")
return errors.New("no messages available")
}
configurationChan <- p.messages[0]

View file

@ -171,9 +171,11 @@ func Test_Routing(t *testing.T) {
map[string]traefiktls.Store{},
map[string]traefiktls.Options{
"default": {
MinVersion: "VersionTLS10",
MaxVersion: "VersionTLS10",
},
"tls10": {
MinVersion: "VersionTLS10",
MaxVersion: "VersionTLS10",
},
"tls12": {

View file

@ -381,7 +381,7 @@ func writeCloser(conn net.Conn) (tcp.WriteCloser, error) {
case *proxyproto.Conn:
underlying, ok := typedConn.TCPConn()
if !ok {
return nil, fmt.Errorf("underlying connection is not a tcp connection")
return nil, errors.New("underlying connection is not a tcp connection")
}
return &writeCloserWrapper{writeCloser: underlying, Conn: typedConn}, nil
case *net.TCPConn:
@ -632,7 +632,6 @@ func createHTTPServer(ctx context.Context, ln net.Listener, configuration *stati
MaxConcurrentStreams: uint32(configuration.HTTP2.MaxConcurrentStreams),
NewWriteScheduler: func() http2.WriteScheduler { return http2.NewPriorityWriteScheduler(nil) },
})
if err != nil {
return nil, fmt.Errorf("configure HTTP/2 server: %w", err)
}

View file

@ -4,9 +4,9 @@ import (
"container/heap"
"context"
"errors"
"fmt"
"hash/fnv"
"net/http"
"strconv"
"sync"
"github.com/traefik/traefik/v2/pkg/config/dynamic"
@ -156,7 +156,7 @@ func (b *Balancer) nextServer() (*namedHandler, error) {
defer b.handlersMu.Unlock()
if len(b.handlers) == 0 {
return nil, fmt.Errorf("no servers in the pool")
return nil, errors.New("no servers in the pool")
}
if len(b.status) == 0 {
return nil, errNoAvailableServer
@ -252,5 +252,5 @@ func hash(input string) string {
// We purposely ignore the error because the implementation always returns nil.
_, _ = hasher.Write([]byte(input))
return fmt.Sprintf("%x", hasher.Sum64())
return strconv.FormatUint(hasher.Sum64(), 16)
}