Skip to content

Commit 74034d4

Browse files
authored
pkg/server: using the correct errors import package (#56423)
1 parent 8e33fcd commit 74034d4

File tree

5 files changed

+7
-10
lines changed

5 files changed

+7
-10
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ require (
2727
github.com/cheggaaa/pb/v3 v3.0.8
2828
github.com/cheynewallace/tabby v1.1.1
2929
github.com/cloudfoundry/gosigar v1.3.6
30-
github.com/cockroachdb/errors v1.11.1
3130
github.com/cockroachdb/pebble v1.1.0
3231
github.com/coocood/freecache v1.2.1
3332
github.com/coreos/go-semver v0.3.1
@@ -155,6 +154,7 @@ require (
155154
filippo.io/edwards25519 v1.1.0 // indirect
156155
github.com/andybalholm/brotli v1.0.5 // indirect
157156
github.com/apache/arrow/go/v12 v12.0.1 // indirect
157+
github.com/cockroachdb/errors v1.11.1 // indirect
158158
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
159159
github.com/getsentry/sentry-go v0.27.0 // indirect
160160
github.com/goccy/go-reflect v1.2.0 // indirect

pkg/server/tests/servertestkit/BUILD.bazel

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ go_library(
1919
"//pkg/util/cpuprofile",
2020
"//pkg/util/topsql/collector/mock",
2121
"//pkg/util/topsql/state",
22-
"@com_github_cockroachdb_errors//:errors",
22+
"@com_github_pingcap_errors//:errors",
2323
"@com_github_stretchr_testify//require",
2424
"@io_opencensus_go//stats/view",
25-
"@org_uber_go_zap//:zap",
2625
],
2726
)

pkg/server/tests/servertestkit/testkit.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"testing"
2222
"time"
2323

24-
"github.com/cockroachdb/errors"
24+
"github.com/pingcap/errors"
2525
"github.com/pingcap/tidb/pkg/config"
2626
"github.com/pingcap/tidb/pkg/domain"
2727
"github.com/pingcap/tidb/pkg/kv"
@@ -37,7 +37,6 @@ import (
3737
topsqlstate "github.com/pingcap/tidb/pkg/util/topsql/state"
3838
"github.com/stretchr/testify/require"
3939
"go.opencensus.io/stats/view"
40-
"go.uber.org/zap"
4140
)
4241

4342
// TidbTestSuite is a test suite for tidb
@@ -79,7 +78,7 @@ func parseDuration(lease string) (time.Duration, error) {
7978
dur, err = time.ParseDuration(lease + "s")
8079
}
8180
if err != nil || dur < 0 {
82-
return 0, errors.Newf("invalid lease duration", zap.String("lease", lease))
81+
return 0, errors.Errorf("invalid lease duration: %s", lease)
8382
}
8483
return dur, nil
8584
}

pkg/util/cgroup/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ go_library(
1212
importpath = "github.com/pingcap/tidb/pkg/util/cgroup",
1313
visibility = ["//visibility:public"],
1414
deps = [
15-
"@com_github_cockroachdb_errors//:errors",
1615
"@com_github_pingcap_errors//:errors",
1716
"@com_github_pingcap_log//:log",
1817
"@org_uber_go_zap//:zap",

pkg/util/cgroup/cgroup.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"strconv"
2727
"strings"
2828

29-
"github.com/cockroachdb/errors"
29+
"github.com/pingcap/errors"
3030
"github.com/pingcap/log"
3131
"go.uber.org/zap"
3232
)
@@ -136,7 +136,7 @@ func readFile(filepath string) (res []byte, err error) {
136136
return nil, err
137137
}
138138
defer func() {
139-
err = errors.CombineErrors(err, f.Close())
139+
err = errors.Join(err, f.Close())
140140
}()
141141
res, err = io.ReadAll(f)
142142
return res, err
@@ -404,7 +404,7 @@ func detectCPUUsageInV2(cRoot string) (stime, utime uint64, err error) {
404404
return 0, 0, errors.Wrapf(err, "can't read cpu usage from cgroup v2 at %s", statFilePath)
405405
}
406406
defer func() {
407-
err = errors.CombineErrors(err, stat.Close())
407+
err = errors.Join(err, stat.Close())
408408
}()
409409

410410
scanner := bufio.NewScanner(stat)

0 commit comments

Comments
 (0)