mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 20:36:12 +02:00
lint: github.com/pkg/errors -> errors (#3091)
This commit is contained in:
parent
4b988701ed
commit
0e93f98cad
4 changed files with 15 additions and 18 deletions
|
@ -1,13 +1,13 @@
|
|||
package exprhelpers
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/bluele/gcache"
|
||||
"github.com/crowdsecurity/crowdsec/pkg/cticlient"
|
||||
"github.com/crowdsecurity/crowdsec/pkg/types"
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
|
@ -40,7 +40,7 @@ func InitCrowdsecCTI(Key *string, TTL *time.Duration, Size *int, LogLevel *log.L
|
|||
}
|
||||
clog := log.New()
|
||||
if err := types.ConfigureLogger(clog); err != nil {
|
||||
return errors.Wrap(err, "while configuring datasource logger")
|
||||
return fmt.Errorf("while configuring datasource logger: %w", err)
|
||||
}
|
||||
if LogLevel != nil {
|
||||
clog.SetLevel(*LogLevel)
|
||||
|
|
|
@ -2,12 +2,12 @@ package exprhelpers
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -936,7 +936,7 @@ func TestGetDecisionsCount(t *testing.T) {
|
|||
SaveX(context.Background())
|
||||
|
||||
if decision == nil {
|
||||
require.Error(t, errors.Errorf("Failed to create sample decision"))
|
||||
require.Error(t, errors.New("Failed to create sample decision"))
|
||||
}
|
||||
|
||||
err = Init(dbClient)
|
||||
|
@ -1022,7 +1022,7 @@ func TestGetDecisionsSinceCount(t *testing.T) {
|
|||
SetOrigin("CAPI").
|
||||
SaveX(context.Background())
|
||||
if decision == nil {
|
||||
require.Error(t, errors.Errorf("Failed to create sample decision"))
|
||||
require.Error(t, errors.New("Failed to create sample decision"))
|
||||
}
|
||||
|
||||
decision2 := dbClient.Ent.Decision.Create().
|
||||
|
@ -1041,7 +1041,7 @@ func TestGetDecisionsSinceCount(t *testing.T) {
|
|||
SaveX(context.Background())
|
||||
|
||||
if decision2 == nil {
|
||||
require.Error(t, errors.Errorf("Failed to create sample decision"))
|
||||
require.Error(t, errors.New("Failed to create sample decision"))
|
||||
}
|
||||
|
||||
err = Init(dbClient)
|
||||
|
@ -1147,7 +1147,7 @@ func TestGetActiveDecisionsCount(t *testing.T) {
|
|||
SaveX(context.Background())
|
||||
|
||||
if decision == nil {
|
||||
require.Error(t, errors.Errorf("Failed to create sample decision"))
|
||||
require.Error(t, errors.New("Failed to create sample decision"))
|
||||
}
|
||||
|
||||
expiredDecision := dbClient.Ent.Decision.Create().
|
||||
|
@ -1165,7 +1165,7 @@ func TestGetActiveDecisionsCount(t *testing.T) {
|
|||
SaveX(context.Background())
|
||||
|
||||
if expiredDecision == nil {
|
||||
require.Error(t, errors.Errorf("Failed to create sample decision"))
|
||||
require.Error(t, errors.New("Failed to create sample decision"))
|
||||
}
|
||||
|
||||
err = Init(dbClient)
|
||||
|
@ -1253,7 +1253,7 @@ func TestGetActiveDecisionsTimeLeft(t *testing.T) {
|
|||
SaveX(context.Background())
|
||||
|
||||
if decision == nil {
|
||||
require.Error(t, errors.Errorf("Failed to create sample decision"))
|
||||
require.Error(t, errors.New("Failed to create sample decision"))
|
||||
}
|
||||
|
||||
longerDecision := dbClient.Ent.Decision.Create().
|
||||
|
@ -1271,7 +1271,7 @@ func TestGetActiveDecisionsTimeLeft(t *testing.T) {
|
|||
SaveX(context.Background())
|
||||
|
||||
if longerDecision == nil {
|
||||
require.Error(t, errors.Errorf("Failed to create sample decision"))
|
||||
require.Error(t, errors.New("Failed to create sample decision"))
|
||||
}
|
||||
|
||||
err = Init(dbClient)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue