diff options
author | Tatsuya Kaneko <catatsuy@catatsuy.org> | 2022-04-27 04:24:26 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-26 12:24:26 -0700 |
commit | 63c2960be651bb95aaf14535bd5e36e86b6b5458 (patch) | |
tree | 430505cad88a42ded8e0324d042ff7d15002c9ef | |
parent | 71220fc3ca5513eaf3583d10fd18da893bc332d8 (diff) | |
download | go-cmp-63c2960be651bb95aaf14535bd5e36e86b6b5458.tar.gz |
remove xerrors (#292)
Versions older than Go 1.13 are no longer in use. Remove unnecessary
dependencies.
-rw-r--r-- | .github/workflows/test.yml | 2 | ||||
-rw-r--r-- | cmp/cmpopts/errors_xerrors.go | 19 | ||||
-rw-r--r-- | cmp/cmpopts/util_test.go | 13 | ||||
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 2 |
5 files changed, 7 insertions, 31 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9a50673..a93f058 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ jobs: test: strategy: matrix: - go-version: [1.11.x, 1.12.x, 1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x, 1.18.x] + go-version: [1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x, 1.18.x] os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} steps: diff --git a/cmp/cmpopts/errors_xerrors.go b/cmp/cmpopts/errors_xerrors.go deleted file mode 100644 index 60b0727..0000000 --- a/cmp/cmpopts/errors_xerrors.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2021, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !go1.13 -// +build !go1.13 - -// TODO(≥go1.13): For support on <go1.13, we use the xerrors package. -// Drop this file when we no longer support older Go versions. - -package cmpopts - -import "golang.org/x/xerrors" - -func compareErrors(x, y interface{}) bool { - xe := x.(error) - ye := y.(error) - return xerrors.Is(xe, ye) || xerrors.Is(ye, xe) -} diff --git a/cmp/cmpopts/util_test.go b/cmp/cmpopts/util_test.go index b19bcab..c2eaf0b 100644 --- a/cmp/cmpopts/util_test.go +++ b/cmp/cmpopts/util_test.go @@ -17,7 +17,6 @@ import ( "time" "github.com/google/go-cmp/cmp" - "golang.org/x/xerrors" ) type ( @@ -531,14 +530,14 @@ func TestOptions(t *testing.T) { reason: "user-defined EOF is not exactly equal", }, { label: "EquateErrors", - x: xerrors.Errorf("wrapped: %w", io.EOF), + x: fmt.Errorf("wrapped: %w", io.EOF), y: io.EOF, opts: []cmp.Option{EquateErrors()}, wantEqual: true, reason: "wrapped io.EOF is equal according to errors.Is", }, { label: "EquateErrors", - x: xerrors.Errorf("wrapped: %w", io.EOF), + x: fmt.Errorf("wrapped: %w", io.EOF), y: io.EOF, wantEqual: false, reason: "wrapped io.EOF is not equal without EquateErrors option", @@ -585,14 +584,14 @@ func TestOptions(t *testing.T) { reason: "user-defined EOF is not exactly equal", }, { label: "EquateErrors", - x: xerrors.Errorf("wrapped: %w", io.EOF), + x: fmt.Errorf("wrapped: %w", io.EOF), y: io.EOF, opts: []cmp.Option{EquateErrors()}, wantEqual: true, reason: "wrapped io.EOF is equal according to errors.Is", }, { label: "EquateErrors", - x: xerrors.Errorf("wrapped: %w", io.EOF), + x: fmt.Errorf("wrapped: %w", io.EOF), y: io.EOF, wantEqual: false, reason: "wrapped io.EOF is not equal without EquateErrors option", @@ -639,14 +638,14 @@ func TestOptions(t *testing.T) { reason: "user-defined EOF is not exactly equal", }, { label: "EquateErrors", - x: struct{ E error }{xerrors.Errorf("wrapped: %w", io.EOF)}, + x: struct{ E error }{fmt.Errorf("wrapped: %w", io.EOF)}, y: struct{ E error }{io.EOF}, opts: []cmp.Option{EquateErrors()}, wantEqual: true, reason: "wrapped io.EOF is equal according to errors.Is", }, { label: "EquateErrors", - x: struct{ E error }{xerrors.Errorf("wrapped: %w", io.EOF)}, + x: struct{ E error }{fmt.Errorf("wrapped: %w", io.EOF)}, y: struct{ E error }{io.EOF}, wantEqual: false, reason: "wrapped io.EOF is not equal without EquateErrors option", @@ -1,5 +1,3 @@ module github.com/google/go-cmp go 1.11 - -require golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 @@ -1,2 +0,0 @@ -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= |