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

@@ -29,10 +29,10 @@ const (
// SchemaFiles contains embedded SQL migration files.
//
//go:embed schema/*.sql
var SchemaFiles embed.FS //nolint:gochecknoglobals
var SchemaFiles embed.FS
// DatabaseParams defines the dependencies for creating a Database.
type DatabaseParams struct {
// Params defines the dependencies for creating a Database.
type Params struct {
fx.In
Logger *logger.Logger
@@ -43,7 +43,7 @@ type DatabaseParams struct {
type Database struct {
db *sql.DB
log *slog.Logger
params *DatabaseParams
params *Params
}
// GetDB returns the underlying sql.DB connection.
@@ -67,7 +67,7 @@ func (s *Database) NewChannel(id int64, name, topic, modes string, createdAt, up
}
// New creates a new Database instance and registers lifecycle hooks.
func New(lc fx.Lifecycle, params DatabaseParams) (*Database, error) {
func New(lc fx.Lifecycle, params Params) (*Database, error) {
s := new(Database)
s.params = &params
s.log = params.Logger.Get()
@@ -80,7 +80,7 @@ func New(lc fx.Lifecycle, params DatabaseParams) (*Database, error) {
return s.connect(ctx)
},
OnStop: func(ctx context.Context) error {
OnStop: func(_ context.Context) error {
s.log.Info("Database OnStop Hook")
if s.db != nil {