style(benchmark): 修复代码格式和忽略无用错误返回值

This commit is contained in:
xfy 2026-04-09 12:19:08 +08:00
parent 668ecde6db
commit 84c26c61ca
6 changed files with 12 additions and 12 deletions

View File

@ -24,9 +24,9 @@ func setupStaticTestDir() (string, func()) {
// 创建测试文件 // 创建测试文件
testFiles := map[string][]byte{ testFiles := map[string][]byte{
"index.html": []byte("<html><body>Index</body></html>"), "index.html": []byte("<html><body>Index</body></html>"),
"style.css": make([]byte, 1024), // 1KB "style.css": make([]byte, 1024), // 1KB
"large.json": make([]byte, 10*1024), // 10KB "large.json": make([]byte, 10*1024), // 10KB
"nested/file.js": make([]byte, 5*1024), // 5KB "nested/file.js": make([]byte, 5*1024), // 5KB
} }
for path, content := range testFiles { for path, content := range testFiles {
@ -40,7 +40,7 @@ func setupStaticTestDir() (string, func()) {
} }
cleanup := func() { cleanup := func() {
os.RemoveAll(dir) _ = os.RemoveAll(dir)
} }
return dir, cleanup return dir, cleanup

View File

@ -21,7 +21,7 @@ func BenchmarkAccessLogProcess(b *testing.B) {
}, },
} }
al := New(cfg) al := New(cfg)
defer al.Close() defer func() { _ = al.Close() }()
mockHandler := func(ctx *fasthttp.RequestCtx) { mockHandler := func(ctx *fasthttp.RequestCtx) {
ctx.SetStatusCode(fasthttp.StatusOK) ctx.SetStatusCode(fasthttp.StatusOK)
@ -49,7 +49,7 @@ func BenchmarkAccessLogProcessParallel(b *testing.B) {
}, },
} }
al := New(cfg) al := New(cfg)
defer al.Close() defer func() { _ = al.Close() }()
mockHandler := func(ctx *fasthttp.RequestCtx) { mockHandler := func(ctx *fasthttp.RequestCtx) {
ctx.SetStatusCode(fasthttp.StatusOK) ctx.SetStatusCode(fasthttp.StatusOK)