mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-26 17:46:34 +03:00
Go 1.26 and golangci-lint updates (#2146)
Keep Go 1.24 compatibility for now (by not using `wg.Go()`).
This commit is contained in:
+1
-1
@@ -27,7 +27,7 @@ func NewFunc(f func(ctx any)) func(ctx any) bool {
|
||||
funcWorkCh := make(chan *funcWork, runtime.GOMAXPROCS(-1)*2048)
|
||||
onceInit := func() {
|
||||
n := runtime.GOMAXPROCS(-1)
|
||||
for i := 0; i < n; i++ {
|
||||
for range n {
|
||||
go funcWorker(funcWorkCh, f)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ func TestNewFuncSimple(t *testing.T) {
|
||||
})
|
||||
|
||||
iterations := 4 * 1024
|
||||
for i := 0; i < iterations; i++ {
|
||||
for range iterations {
|
||||
if !f(2) {
|
||||
t.Fatalf("f mustn't return false")
|
||||
}
|
||||
@@ -42,7 +42,7 @@ func TestNewFuncMulti(t *testing.T) {
|
||||
f1Done := make(chan error, 1)
|
||||
go func() {
|
||||
var err error
|
||||
for i := 0; i < iterations; i++ {
|
||||
for range iterations {
|
||||
if !f1(3) {
|
||||
err = errors.New("f1 mustn't return false")
|
||||
break
|
||||
@@ -54,7 +54,7 @@ func TestNewFuncMulti(t *testing.T) {
|
||||
f2Done := make(chan error, 1)
|
||||
go func() {
|
||||
var err error
|
||||
for i := 0; i < iterations; i++ {
|
||||
for range iterations {
|
||||
if !f2(5) {
|
||||
err = errors.New("f2 mustn't return false")
|
||||
break
|
||||
|
||||
@@ -70,7 +70,7 @@ func testWriter(newWriter NewWriterFunc, newReader func(io.Reader) io.Reader) er
|
||||
dstW := &bytes.Buffer{}
|
||||
w := NewWriter(dstW, newWriter)
|
||||
|
||||
for i := 0; i < 5; i++ {
|
||||
for i := range 5 {
|
||||
if err := testWriterReuse(w, dstW, newReader); err != nil {
|
||||
return fmt.Errorf("unexpected error when re-using writer on iteration %d: %w", i, err)
|
||||
}
|
||||
@@ -84,7 +84,7 @@ func testWriter(newWriter NewWriterFunc, newReader func(io.Reader) io.Reader) er
|
||||
func testWriterReuse(w Writer, r io.Reader, newReader func(io.Reader) io.Reader) error {
|
||||
wantW := &bytes.Buffer{}
|
||||
mw := io.MultiWriter(w, wantW)
|
||||
for i := 0; i < 30; i++ {
|
||||
for i := range 30 {
|
||||
fmt.Fprintf(mw, "foobar %d\n", i)
|
||||
if i%13 == 0 {
|
||||
if err := w.Flush(); err != nil {
|
||||
@@ -110,12 +110,12 @@ func testWriterReuse(w Writer, r io.Reader, newReader func(io.Reader) io.Reader)
|
||||
|
||||
func testConcurrent(testFunc func() error, concurrency int) error {
|
||||
ch := make(chan error, concurrency)
|
||||
for i := 0; i < concurrency; i++ {
|
||||
for range concurrency {
|
||||
go func() {
|
||||
ch <- testFunc()
|
||||
}()
|
||||
}
|
||||
for i := 0; i < concurrency; i++ {
|
||||
for i := range concurrency {
|
||||
select {
|
||||
case err := <-ch:
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user