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

@@ -1,3 +1,4 @@
// Package database provides database client and connection management.
package database
import (
@@ -20,11 +21,11 @@ type Client struct {
// Config holds database configuration.
type Config struct {
DSN string
MaxConnections int
MaxIdleConns int
ConnMaxLifetime time.Duration
ConnMaxIdleTime time.Duration
DSN string
MaxConnections int
MaxIdleConns int
ConnMaxLifetime time.Duration
ConnMaxIdleTime time.Duration
}
// NewClient creates a new Ent client with connection pooling.
@@ -46,7 +47,7 @@ func NewClient(cfg Config) (*Client, error) {
defer cancel()
if err := db.PingContext(ctx); err != nil {
db.Close()
_ = db.Close()
return nil, fmt.Errorf("failed to ping database: %w", err)
}
@@ -72,7 +73,7 @@ func (c *Client) Close() error {
// Migrate runs database migrations.
func (c *Client) Migrate(ctx context.Context) error {
return c.Client.Schema.Create(ctx)
return c.Schema.Create(ctx)
}
// Ping checks database connectivity.
@@ -84,4 +85,3 @@ func (c *Client) Ping(ctx context.Context) error {
func (c *Client) DB() *sql.DB {
return c.db
}