style(netutil,server,test): 修复代码格式问题,更新文档

- 修复 server.go 缩进问题
- 添加文件末尾换行符
- 格式化测试文件表格对齐
- 更新 update-prompts.md 添加新任务

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
xfy 2026-04-07 11:38:54 +08:00
parent ff260def3b
commit 3cc2dc7625
7 changed files with 19 additions and 17 deletions

View File

@ -15,6 +15,8 @@
/plan 深度分析一个完善测试的方案
/ultrawork 分析并完善测试覆盖率,每完成一个功能点提交一次
## 注释
/ultrawork 参考 @docs/comments.md深度分析项目注释是否完善
@ -25,4 +27,4 @@
/ultrawork 深度分析下,有没有重复的逻辑/代码,或者冗余的东西
/ultrawork 运行 make lint并修复
/ultrawork 运行 make lint并修复

View File

@ -176,4 +176,4 @@ func TestSlidingWindowLimiter_GetCount(t *testing.T) {
if count != 0 {
t.Errorf("GetCount(nonexistent) = %d, want 0", count)
}
}
}

View File

@ -109,4 +109,4 @@ func GetRemoteAddrIP(ctx *fasthttp.RequestCtx) net.IP {
}
}
return nil
}
}

View File

@ -65,10 +65,10 @@ func TestExtractClientIP(t *testing.T) {
func TestExtractClientIPNet(t *testing.T) {
tests := []struct {
name string
xff string
xri string
want net.IP
name string
xff string
xri string
want net.IP
}{
{
name: "X-Forwarded-For valid IP",
@ -120,4 +120,4 @@ func TestGetRemoteAddrIP(t *testing.T) {
// The result depends on how fasthttp initializes the remote addr
// Just verify it doesn't panic
_ = got
}
}

View File

@ -73,4 +73,4 @@ func ParseTargetURL(targetURL string, addDefaultPort bool) (addr string, isTLS b
func ExtractHost(targetURL string) string {
addr, _ := ParseTargetURL(targetURL, true)
return addr
}
}

View File

@ -4,11 +4,11 @@ import "testing"
func TestParseTargetURL(t *testing.T) {
tests := []struct {
name string
targetURL string
addDefaultPort bool
wantAddr string
wantIsTLS bool
name string
targetURL string
addDefaultPort bool
wantAddr string
wantIsTLS bool
}{
// HTTP without port
{
@ -144,4 +144,4 @@ func TestExtractHost(t *testing.T) {
}
})
}
}
}

View File

@ -340,8 +340,8 @@ func (s *Server) startSingleMode() error {
// 注册代理路由
s.registerProxyRoutes(router, &s.config.Server)
// 静态文件服务
s.registerStaticHandler(router, &s.config.Server)
// 静态文件服务
s.registerStaticHandler(router, &s.config.Server)
// 构建中间件链
chain, err := s.buildMiddlewareChain(&s.config.Server)