fix: replace fmt.Errorf with signoz/pkg/errors and update golangci-li… (#9373)

This PR fulfills the requirements of #9069 by:

- Adding a golangci-lint directive (forbidigo) to disallow all fmt.Errorf usages.
- Replacing existing fmt.Errorf instances with structured errors from github.com/SigNoz/signoz/pkg/errors for consistent error classification and lint compliance.
- Verified lint and build integrity.
This commit is contained in:
Pranjul Kalsi
2025-10-27 16:30:18 +05:30
committed by GitHub
parent 5f8cfbe474
commit bdce97a727
56 changed files with 315 additions and 293 deletions
+3 -4
View File
@@ -3,7 +3,6 @@ package sqlstoretest
import (
"context"
"database/sql"
"fmt"
"github.com/DATA-DOG/go-sqlmock"
"github.com/SigNoz/signoz/pkg/errors"
@@ -35,7 +34,7 @@ func New(config sqlstore.Config, matcher sqlmock.QueryMatcher) *Provider {
} else if config.Provider == "postgres" {
bunDB = bun.NewDB(db, pgdialect.New())
} else {
panic(fmt.Errorf("provider %q is not supported", config.Provider))
panic(errors.NewInvalidInputf(errors.CodeInvalidInput, "provider %q is not supported", config.Provider))
}
return &Provider{
@@ -71,9 +70,9 @@ func (provider *Provider) RunInTxCtx(ctx context.Context, opts *sql.TxOptions, c
}
func (provider *Provider) WrapNotFoundErrf(err error, code errors.Code, format string, args ...any) error {
return fmt.Errorf(format, args...)
return errors.WrapNotFoundf(err, code, format, args...)
}
func (provider *Provider) WrapAlreadyExistsErrf(err error, code errors.Code, format string, args ...any) error {
return fmt.Errorf(format, args...)
return errors.Wrapf(err, errors.TypeAlreadyExists, code, format, args...)
}