Skip to content

Commit 4df0b4d

Browse files
committed
pkg/client/apiutil: prune uses of xerrors
1 parent c14d8e6 commit 4df0b4d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

pkg/client/apiutil/dynamicrestmapper.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ limitations under the License.
1717
package apiutil
1818

1919
import (
20+
"errors"
2021
"sync"
2122
"time"
2223

2324
"golang.org/x/time/rate"
24-
"golang.org/x/xerrors"
2525
"k8s.io/apimachinery/pkg/api/meta"
2626
"k8s.io/apimachinery/pkg/runtime/schema"
2727
"k8s.io/client-go/discovery"
@@ -45,7 +45,7 @@ func (e ErrRateLimited) Error() string {
4545
// time.Duration value and false are returned if err is not a ErrRateLimited.
4646
func DelayIfRateLimited(err error) (time.Duration, bool) {
4747
var rlerr ErrRateLimited
48-
if xerrors.As(err, &rlerr) {
48+
if errors.As(err, &rlerr) {
4949
return rlerr.Delay, true
5050
}
5151
return 0, false
@@ -182,7 +182,7 @@ func (drm *dynamicRESTMapper) checkAndReload(needsReloadErr error, checkNeedsRel
182182
// NB(directxman12): `Is` and `As` have a confusing relationship --
183183
// `Is` is like `== or does this implement .Is`, whereas `As` says
184184
// `can I type-assert into`
185-
needsReload := xerrors.As(err, &needsReloadErr)
185+
needsReload := errors.As(err, &needsReloadErr)
186186
if !needsReload {
187187
return err
188188
}
@@ -193,7 +193,7 @@ func (drm *dynamicRESTMapper) checkAndReload(needsReloadErr error, checkNeedsRel
193193

194194
// ... and double-check that we didn't reload in the meantime
195195
err = checkNeedsReload()
196-
needsReload = xerrors.As(err, &needsReloadErr)
196+
needsReload = errors.As(err, &needsReloadErr)
197197
if !needsReload {
198198
return err
199199
}

pkg/client/apiutil/dynamicrestmapper_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package apiutil_test
22

33
import (
4+
"errors"
45
"time"
56

67
. "github.com/onsi/ginkgo"
78
. "github.com/onsi/gomega"
89
"golang.org/x/time/rate"
9-
"golang.org/x/xerrors"
1010
"k8s.io/apimachinery/pkg/api/meta"
1111
"k8s.io/apimachinery/pkg/runtime/schema"
1212

@@ -82,7 +82,7 @@ var _ = Describe("Dynamic REST Mapper", func() {
8282

8383
By("calling another time that would need a requery and failing")
8484
Eventually(func() bool {
85-
return xerrors.As(callWithTarget(), &apiutil.ErrRateLimited{})
85+
return errors.As(callWithTarget(), &apiutil.ErrRateLimited{})
8686
}, "10s").Should(BeTrue())
8787
})
8888

0 commit comments

Comments
 (0)