exp/errors: rename xerrors to errors
Change-Id: Ia6699b82c3d75b2dc8b3f5935df75a6073459632
Reviewed-on: https://go-review.googlesource.com/c/140817
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/xerrors/errors.go b/errors/errors.go
similarity index 89%
rename from xerrors/errors.go
rename to errors/errors.go
index 3ce4367..fddd11c 100644
--- a/xerrors/errors.go
+++ b/errors/errors.go
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// Package xerrors implements functions to manipulate errors.
+// Package errors implements functions to manipulate errors.
//
// This package implements the Go 2 draft designs for error inspection and printing:
// https://go.googlesource.com/proposal/+/master/design/go2draft.md
//
// This is an EXPERIMENTAL package, and may change in arbitrary ways without notice.
-package xerrors
+package errors
// errorString is a trivial implementation of error.
type errorString struct {
diff --git a/xerrors/errors_test.go b/errors/errors_test.go
similarity index 79%
rename from xerrors/errors_test.go
rename to errors/errors_test.go
index e33179b..6c0d793 100644
--- a/xerrors/errors_test.go
+++ b/errors/errors_test.go
@@ -2,40 +2,40 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package xerrors_test
+package errors_test
import (
"fmt"
"testing"
- "golang.org/x/exp/xerrors"
+ "golang.org/x/exp/errors"
)
func TestNewEqual(t *testing.T) {
// Different allocations should not be equal.
- if xerrors.New("abc") == xerrors.New("abc") {
+ if errors.New("abc") == errors.New("abc") {
t.Errorf(`New("abc") == New("abc")`)
}
- if xerrors.New("abc") == xerrors.New("xyz") {
+ if errors.New("abc") == errors.New("xyz") {
t.Errorf(`New("abc") == New("xyz")`)
}
// Same allocation should be equal to itself (not crash).
- err := xerrors.New("jkl")
+ err := errors.New("jkl")
if err != err {
t.Errorf(`err != err`)
}
}
func TestErrorMethod(t *testing.T) {
- err := xerrors.New("abc")
+ err := errors.New("abc")
if err.Error() != "abc" {
t.Errorf(`New("abc").Error() = %q, want %q`, err.Error(), "abc")
}
}
func ExampleNew() {
- err := xerrors.New("emit macho dwarf: elf header corrupted")
+ err := errors.New("emit macho dwarf: elf header corrupted")
if err != nil {
fmt.Print(err)
}
diff --git a/xerrors/example_test.go b/errors/example_test.go
similarity index 96%
rename from xerrors/example_test.go
rename to errors/example_test.go
index 107f80c..5dc8841 100644
--- a/xerrors/example_test.go
+++ b/errors/example_test.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package xerrors_test
+package errors_test
import (
"fmt"
diff --git a/errors/go.mod b/errors/go.mod
new file mode 100644
index 0000000..c2e2976
--- /dev/null
+++ b/errors/go.mod
@@ -0,0 +1 @@
+module golang.org/x/exp/errors
diff --git a/xerrors/go.mod b/xerrors/go.mod
deleted file mode 100644
index dbf4488..0000000
--- a/xerrors/go.mod
+++ /dev/null
@@ -1 +0,0 @@
-module golang.org/x/exp/xerrors
diff --git a/xerrors/go.sum b/xerrors/go.sum
deleted file mode 100644
index c9cfadf..0000000
--- a/xerrors/go.sum
+++ /dev/null
@@ -1 +0,0 @@
-golang.org/x/exp v0.0.0-20180907224206-e88728d35e99 h1:7IN8+ZMp04l/19EF+wsr7NM1jyvcadKINimAtWRyQk8=