utils: switch to standard library min and max functions (#4218)

These functions were added in Go 1.21.
This commit is contained in:
Marten Seemann
2023-12-28 12:19:13 +07:00
committed by GitHub
parent 18c591c75a
commit 22411e16d5
24 changed files with 44 additions and 78 deletions

View File

@@ -5,7 +5,6 @@ import (
"fmt"
"github.com/quic-go/quic-go"
"github.com/quic-go/quic-go/internal/utils"
)
// A Stream is a HTTP/3 stream.
@@ -115,7 +114,7 @@ func (s *lengthLimitedStream) Read(b []byte) (int, error) {
if err := s.checkContentLengthViolation(); err != nil {
return 0, err
}
n, err := s.stream.Read(b[:utils.Min(int64(len(b)), s.contentLength-s.read)])
n, err := s.stream.Read(b[:min(int64(len(b)), s.contentLength-s.read)])
s.read += int64(n)
if err := s.checkContentLengthViolation(); err != nil {
return n, err