refactor (util): move from github.com/pkg/errors to 'errors' and 'fmt' (#10877)

Signed-off-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>

Co-authored-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
This commit is contained in:
Matthieu MOREL 2022-06-27 18:16:58 +02:00 committed by GitHub
parent 735a07444a
commit 6375417324
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -14,11 +14,11 @@
package logging
import (
"fmt"
"os"
"time"
"github.com/go-kit/log"
"github.com/pkg/errors"
)
var timestampFormat = log.TimestampFormat(
@ -40,7 +40,7 @@ func NewJSONFileLogger(s string) (*JSONFileLogger, error) {
f, err := os.OpenFile(s, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o666)
if err != nil {
return nil, errors.Wrap(err, "can't create json logger")
return nil, fmt.Errorf("can't create json logger: %w", err)
}
return &JSONFileLogger{

View File

@ -15,6 +15,7 @@ package treecache
import (
"bytes"
"errors"
"fmt"
"strings"
"sync"
@ -23,7 +24,6 @@ import (
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/go-zookeeper/zk"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
)
@ -214,10 +214,10 @@ func (tc *ZookeeperTreeCache) loop(path string) {
func (tc *ZookeeperTreeCache) recursiveNodeUpdate(path string, node *zookeeperTreeCacheNode) error {
data, _, dataWatcher, err := tc.conn.GetW(path)
if err == zk.ErrNoNode {
if errors.Is(err, zk.ErrNoNode) {
tc.recursiveDelete(path, node)
if node == tc.head {
return errors.Errorf("path %s does not exist", path)
return fmt.Errorf("path %s does not exist", path)
}
return nil
} else if err != nil {
@ -230,7 +230,7 @@ func (tc *ZookeeperTreeCache) recursiveNodeUpdate(path string, node *zookeeperTr
}
children, _, childWatcher, err := tc.conn.ChildrenW(path)
if err == zk.ErrNoNode {
if errors.Is(err, zk.ErrNoNode) {
tc.recursiveDelete(path, node)
return nil
} else if err != nil {