style(benchmark): 修复代码格式和忽略无用错误返回值
This commit is contained in:
parent
668ecde6db
commit
84c26c61ca
@ -356,4 +356,4 @@ func (p *BenchmarkContextPool) Put(ctx *BenchmarkContext) {
|
||||
default:
|
||||
// 池已满,丢弃
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,9 +24,9 @@ func setupStaticTestDir() (string, func()) {
|
||||
// 创建测试文件
|
||||
testFiles := map[string][]byte{
|
||||
"index.html": []byte("<html><body>Index</body></html>"),
|
||||
"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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,4 +275,4 @@ func BenchmarkCompressionMiddlewareParallel(b *testing.B) {
|
||||
handler(ctx)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,4 +225,4 @@ func BenchmarkRateLimiterStats(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
rl.GetStats()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,4 +139,4 @@ func BenchmarkSlidingWindowStats(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
sw.GetStats()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user