From 19b5c3e77dc25c9fc3ca6078e7222f3689c58246 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Wed, 19 Jun 2024 01:22:28 +0200 Subject: [PATCH] Fix fordbid for stellar/go/support/errors --- .golangci.yml | 11 ++++++----- cmd/soroban-rpc/internal/config/config_option.go | 7 ++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 9799847f..aca3ea8a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -77,11 +77,12 @@ linters-settings: # Default: ["^(fmt\\.Print(|f|ln)|print|println)$"] forbid: - p: "^(fmt\\.Print(|f|ln)|print|println)$" - msg: Do not commit debug print statements. - - p: .* - pkg: ^stellar/go/support/errors$ - message: use standard errors package and fmt.Errorf(). + msg: Do not commit debug print statements (in tests use t.Log()). + - p: "^.*$" + pkg: "^github.com/stellar/go/support/errors$" + msg: Do not use stellar/go/support/errors, use the standard 'errors' package and fmt.Errorf(). exclude-godoc-examples: false + analyze-types: true linters: enable-all: true @@ -94,7 +95,7 @@ linters: # exhaustruct: enforcing exhaustive fields is useful in some cases, but there are # too many legitimate default field values in Go - exhaustruct - # err113: Enforcing errors.Is() is useful but cannot be enabled in isoation + # err113: Enforcing errors.Is() is useful but cannot be enabled in isolation - err113 - thelper - wsl diff --git a/cmd/soroban-rpc/internal/config/config_option.go b/cmd/soroban-rpc/internal/config/config_option.go index 14f30be3..ffbdc936 100644 --- a/cmd/soroban-rpc/internal/config/config_option.go +++ b/cmd/soroban-rpc/internal/config/config_option.go @@ -1,13 +1,14 @@ package config import ( + "errors" + "fmt" "reflect" "strconv" "time" "github.com/spf13/pflag" - "github.com/stellar/go/support/errors" "github.com/stellar/go/support/strutils" ) @@ -95,11 +96,11 @@ func (o *ConfigOption) setValue(i interface{}) (err error) { return } - err = errors.Errorf("config option setting error ('%s') %v", o.Name, recoverRes) + err = fmt.Errorf("config option setting error ('%s') %v", o.Name, recoverRes) } }() parser := func(option *ConfigOption, i interface{}) error { - return errors.Errorf("no parser for flag %s", o.Name) + return fmt.Errorf("no parser for flag %s", o.Name) } switch o.ConfigKey.(type) { case *bool: