fix: resolve all linting and formatting issues

- Fix error return value checks (errcheck)
- Fix unused parameters by using underscore prefix
- Add missing package comments to all packages
- Fix context key type issue in middleware (use typed contextKey)
- Replace deprecated trace.NewNoopTracerProvider with noop.NewTracerProvider
- Fix embedded field selector in database client
- Remove trailing whitespace
- Remove revive linter (as requested) to avoid stuttering warnings for public API interfaces

All linting and formatting checks now pass.
This commit is contained in:
2025-11-05 20:48:59 +01:00
parent 926f3f927e
commit 52d48590ae
21 changed files with 57 additions and 68 deletions

View File

@@ -19,6 +19,7 @@ import (
"git.dcentral.systems/toolz/goplt/pkg/errorbus"
"git.dcentral.systems/toolz/goplt/pkg/logger"
"go.opentelemetry.io/otel/trace"
"go.opentelemetry.io/otel/trace/noop"
"go.uber.org/fx"
)
@@ -130,7 +131,7 @@ func ProvideDatabase() fx.Option {
log.Info("Database migrations completed successfully")
return nil
},
OnStop: func(ctx context.Context) error {
OnStop: func(_ context.Context) error {
return dbClient.Close()
},
})
@@ -147,7 +148,7 @@ func ProvideErrorBus() fx.Option {
// Register lifecycle hook to close the bus on shutdown
lc.Append(fx.Hook{
OnStop: func(ctx context.Context) error {
OnStop: func(_ context.Context) error {
return bus.Close()
},
})
@@ -181,7 +182,7 @@ func ProvideTracer() fx.Option {
enabled := cfg.GetBool("tracing.enabled")
if !enabled {
// Return no-op tracer
return trace.NewNoopTracerProvider(), nil
return noop.NewTracerProvider(), nil
}
serviceName := cfg.GetString("tracing.service_name")
@@ -248,8 +249,7 @@ func ProvideHTTPServer() fx.Option {
// Register lifecycle hooks
lc.Append(fx.Hook{
OnStart: func(ctx context.Context) error {
OnStart: func(_ context.Context) error {
// Get server address from config
port := cfg.GetInt("server.port")
if port == 0 {
@@ -300,7 +300,7 @@ func ProvideHTTPServer() fx.Option {
)
// Continue anyway - server might still be starting
} else {
resp.Body.Close()
_ = resp.Body.Close()
}
log.Info("HTTP server started successfully",