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

@@ -2,6 +2,7 @@
package config
import (
"errors"
"log/slog"
"git.eeqj.de/sneak/chat/internal/globals"
@@ -12,8 +13,8 @@ import (
_ "github.com/joho/godotenv/autoload" // loads .env file
)
// ConfigParams defines the dependencies for creating a Config.
type ConfigParams struct {
// Params defines the dependencies for creating a Config.
type Params struct {
fx.In
Globals *globals.Globals
@@ -35,12 +36,12 @@ type Config struct {
MOTD string
ServerName string
FederationKey string
params *ConfigParams
params *Params
log *slog.Logger
}
// New creates a new Config by reading from files and environment variables.
func New(_ fx.Lifecycle, params ConfigParams) (*Config, error) {
func New(_ fx.Lifecycle, params Params) (*Config, error) {
log := params.Logger.Get()
name := params.Globals.Appname
@@ -66,7 +67,8 @@ func New(_ fx.Lifecycle, params ConfigParams) (*Config, error) {
err := viper.ReadInConfig()
if err != nil {
if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
var notFound viper.ConfigFileNotFoundError
if !errors.As(err, &notFound) {
log.Error("config file malformed", "error", err)
panic(err)
}