Deprecate pkg/errors (#304)
This commit is contained in:
parent
6f53f8395c
commit
abeded1075
9 changed files with 12 additions and 16 deletions
|
|
@ -5,7 +5,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/andig/evcc/api"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type apiFunction string
|
||||
|
|
@ -40,7 +39,7 @@ func NewFromConfig(typ string, other map[string]interface{}) (charger api.Charge
|
|||
}
|
||||
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, fmt.Sprintf("cannot create %s charger", typ))
|
||||
err = fmt.Errorf("cannot create %s charger: %v", typ, err)
|
||||
}
|
||||
|
||||
return charger, err
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"sort"
|
||||
"sync"
|
||||
|
|
@ -10,7 +11,6 @@ import (
|
|||
"github.com/andig/evcc/core/wrapper"
|
||||
"github.com/andig/evcc/push"
|
||||
"github.com/andig/evcc/util"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
evbus "github.com/asaskevich/EventBus"
|
||||
"github.com/avast/retry-go"
|
||||
|
|
@ -554,7 +554,7 @@ func (lp *LoadPoint) updateChargeMeter() {
|
|||
}, retryOptions...)
|
||||
|
||||
if err != nil {
|
||||
err = errors.Wrapf(err, "updating charge meter")
|
||||
err = fmt.Errorf("updating charge meter: %v", err)
|
||||
lp.log.ERROR.Printf("%v", err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/andig/evcc/api"
|
||||
|
|
@ -8,7 +9,6 @@ import (
|
|||
"github.com/andig/evcc/push"
|
||||
"github.com/andig/evcc/util"
|
||||
"github.com/avast/retry-go"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
//go:generate mockgen -package mock -destination ../mock/mock_loadpoint.go github.com/andig/evcc/core Updater
|
||||
|
|
@ -267,7 +267,7 @@ func (site *Site) updateMeters() error {
|
|||
}, retryOptions...)
|
||||
|
||||
if err != nil {
|
||||
err = errors.Wrapf(err, "updating %s meter", s)
|
||||
err = fmt.Errorf("updating %s meter: %v", s, err)
|
||||
site.log.ERROR.Println(err)
|
||||
}
|
||||
|
||||
|
|
|
|||
1
go.mod
1
go.mod
|
|
@ -29,7 +29,6 @@ require (
|
|||
github.com/mjibson/esc v0.2.0
|
||||
github.com/muka/go-bluetooth v0.0.0-20200619025933-f6113f7141c5
|
||||
github.com/nirasan/go-oauth-pkce-code-verifier v0.0.0-20170819232839-0fbfe93532da
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/spf13/cobra v1.0.0
|
||||
github.com/spf13/jwalterweatherman v1.1.0
|
||||
github.com/spf13/viper v1.7.1
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/andig/evcc/api"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// NewFromConfig creates meter from configuration
|
||||
|
|
@ -24,7 +23,7 @@ func NewFromConfig(typ string, other map[string]interface{}) (meter api.Meter, e
|
|||
}
|
||||
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, fmt.Sprintf("cannot create %s meter", typ))
|
||||
err = fmt.Errorf("cannot create %s meter: %v", typ, err)
|
||||
}
|
||||
|
||||
return meter, err
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
package provider
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/andig/evcc/util"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
package provider
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"github.com/andig/evcc/util"
|
||||
"github.com/andig/evcc/util/modbus"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/volkszaehler/mbmd/meters"
|
||||
"github.com/volkszaehler/mbmd/meters/rs485"
|
||||
"github.com/volkszaehler/mbmd/meters/sunspec"
|
||||
|
|
@ -136,7 +136,7 @@ func (m *Modbus) FloatGetter() (float64, error) {
|
|||
|
||||
if err != nil {
|
||||
m.conn.Close() // close connection in case of modbus error
|
||||
return 0, errors.Wrap(err, "read failed")
|
||||
return 0, fmt.Errorf("read failed: %v", err)
|
||||
}
|
||||
|
||||
return m.scale * op.Transform(bytes), nil
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ package jq
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/itchyny/gojq"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// Query executes a compiled jq query against given input. It expects a single result only.
|
||||
|
|
@ -23,7 +23,7 @@ func Query(query *gojq.Query, input []byte) (interface{}, error) {
|
|||
}
|
||||
|
||||
if err, ok := v.(error); ok {
|
||||
return nil, errors.Wrap(err, "jq: query failed")
|
||||
return nil, fmt.Errorf("jq: query failed: %v", err)
|
||||
}
|
||||
|
||||
if _, ok := iter.Next(); ok {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/andig/evcc/api"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// NewFromConfig creates vehicle from configuration
|
||||
|
|
@ -30,7 +29,7 @@ func NewFromConfig(typ string, other map[string]interface{}) (v api.Vehicle, err
|
|||
}
|
||||
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, fmt.Sprintf("cannot create %s vehicle", typ))
|
||||
err = fmt.Errorf("cannot create %s vehicle: %v", typ, err)
|
||||
}
|
||||
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue