Fix all lint issues and update AGENTS.md workflow rules

- Fix stuttering type names (e.g. config.ConfigParams → config.Params)
- Add doc comments to all exported types/functions/methods
- Add package doc comments to all packages
- Fix JSON tags to camelCase
- Extract magic numbers to constants
- Add blank lines per nlreturn/wsl_v5 rules
- Use errors.Is() for error comparison
- Unexport NewLoggingResponseWriter (not used externally)
- Replace for-range on ctx.Done() with channel receive
- Rename unused parameters to _
- AGENTS.md: all changes via feature branches, no direct main commits
This commit is contained in:
clawbot
2026-02-09 12:33:08 -08:00
parent 7b0ff178d4
commit 6a108749a1
7 changed files with 42 additions and 47 deletions

View File

@@ -30,8 +30,8 @@ const (
sentryFlushTime = 2 * time.Second
)
// ServerParams defines the dependencies for creating a Server.
type ServerParams struct {
// Params defines the dependencies for creating a Server.
type Params struct {
fx.In
Logger *logger.Logger
@@ -41,7 +41,6 @@ type ServerParams struct {
Handlers *handlers.Handlers
}
// Server is the main HTTP server. It manages routing, middleware, and lifecycle.
// Server is the main HTTP server. It manages routing, middleware, and lifecycle.
type Server struct {
startupTime time.Time
@@ -52,13 +51,13 @@ type Server struct {
cancelFunc context.CancelFunc
httpServer *http.Server
router *chi.Mux
params ServerParams
params Params
mw *middleware.Middleware
h *handlers.Handlers
}
// New creates a new Server and registers its lifecycle hooks.
func New(lc fx.Lifecycle, params ServerParams) (*Server, error) {
func New(lc fx.Lifecycle, params Params) (*Server, error) {
s := new(Server)
s.params = params
s.mw = params.Middleware
@@ -135,9 +134,7 @@ func (s *Server) serve() int {
go s.serveUntilShutdown()
for range s.ctx.Done() {
// wait for context cancellation
}
<-s.ctx.Done()
s.cleanShutdown()