diff --git a/internal/benchmark/tools/benchmark_context.go b/internal/benchmark/tools/benchmark_context.go index a6323b9..53a3a2c 100644 --- a/internal/benchmark/tools/benchmark_context.go +++ b/internal/benchmark/tools/benchmark_context.go @@ -356,4 +356,4 @@ func (p *BenchmarkContextPool) Put(ctx *BenchmarkContext) { default: // 池已满,丢弃 } -} \ No newline at end of file +} diff --git a/internal/handler/static_bench_test.go b/internal/handler/static_bench_test.go index dc4c69d..8c3a601 100644 --- a/internal/handler/static_bench_test.go +++ b/internal/handler/static_bench_test.go @@ -24,9 +24,9 @@ func setupStaticTestDir() (string, func()) { // 创建测试文件 testFiles := map[string][]byte{ "index.html": []byte("Index"), - "style.css": make([]byte, 1024), // 1KB - "large.json": make([]byte, 10*1024), // 10KB - "nested/file.js": make([]byte, 5*1024), // 5KB + "style.css": make([]byte, 1024), // 1KB + "large.json": make([]byte, 10*1024), // 10KB + "nested/file.js": make([]byte, 5*1024), // 5KB } for path, content := range testFiles { @@ -40,7 +40,7 @@ func setupStaticTestDir() (string, func()) { } cleanup := func() { - os.RemoveAll(dir) + _ = os.RemoveAll(dir) } return dir, cleanup @@ -210,4 +210,4 @@ func BenchmarkStaticFileLookupWithAlias(b *testing.B) { ctx.Request.SetRequestURI("/static/style.css") handler.Handle(ctx) } -} \ No newline at end of file +} diff --git a/internal/middleware/accesslog/accesslog_bench_test.go b/internal/middleware/accesslog/accesslog_bench_test.go index 13acdea..718771d 100644 --- a/internal/middleware/accesslog/accesslog_bench_test.go +++ b/internal/middleware/accesslog/accesslog_bench_test.go @@ -21,7 +21,7 @@ func BenchmarkAccessLogProcess(b *testing.B) { }, } al := New(cfg) - defer al.Close() + defer func() { _ = al.Close() }() mockHandler := func(ctx *fasthttp.RequestCtx) { ctx.SetStatusCode(fasthttp.StatusOK) @@ -49,7 +49,7 @@ func BenchmarkAccessLogProcessParallel(b *testing.B) { }, } al := New(cfg) - defer al.Close() + defer func() { _ = al.Close() }() mockHandler := func(ctx *fasthttp.RequestCtx) { ctx.SetStatusCode(fasthttp.StatusOK) @@ -67,4 +67,4 @@ func BenchmarkAccessLogProcessParallel(b *testing.B) { handler(ctx) } }) -} \ No newline at end of file +} diff --git a/internal/middleware/compression/compression_bench_test.go b/internal/middleware/compression/compression_bench_test.go index 71e3cea..2d01d1a 100644 --- a/internal/middleware/compression/compression_bench_test.go +++ b/internal/middleware/compression/compression_bench_test.go @@ -275,4 +275,4 @@ func BenchmarkCompressionMiddlewareParallel(b *testing.B) { handler(ctx) } }) -} \ No newline at end of file +} diff --git a/internal/middleware/security/ratelimit_bench_test.go b/internal/middleware/security/ratelimit_bench_test.go index 2304589..13b7c3d 100644 --- a/internal/middleware/security/ratelimit_bench_test.go +++ b/internal/middleware/security/ratelimit_bench_test.go @@ -225,4 +225,4 @@ func BenchmarkRateLimiterStats(b *testing.B) { for i := 0; i < b.N; i++ { rl.GetStats() } -} \ No newline at end of file +} diff --git a/internal/middleware/security/sliding_window_bench_test.go b/internal/middleware/security/sliding_window_bench_test.go index 6a1f2bf..4a6e05a 100644 --- a/internal/middleware/security/sliding_window_bench_test.go +++ b/internal/middleware/security/sliding_window_bench_test.go @@ -139,4 +139,4 @@ func BenchmarkSlidingWindowStats(b *testing.B) { for i := 0; i < b.N; i++ { sw.GetStats() } -} \ No newline at end of file +}