xerrors: Revert "xerrors: redirect to go1.13 primitives for 1.13"

This reverts CL 167577

Reason for revert:
errors.Frame and errors.Formatter were removed in CL 176997

Fixes golang/go#32246

Change-Id: I521cc1176311721a18aaf76d4966e945c8453e9d
Reviewed-on: https://go-review.googlesource.com/c/xerrors/+/177379
Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Joiner <anacrolix@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/adaptor_go1_12.go b/adaptor.go
similarity index 99%
rename from adaptor_go1_12.go
rename to adaptor.go
index 6b9f2f0..4317f24 100644
--- a/adaptor_go1_12.go
+++ b/adaptor.go
@@ -2,8 +2,6 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build !go1.13
-
 package xerrors
 
 import (
diff --git a/adaptor_go1_13.go b/adaptor_go1_13.go
deleted file mode 100644
index 57f519d..0000000
--- a/adaptor_go1_13.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2018 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.
-
-// +build go1.13
-
-package xerrors
-
-import (
-	"errors"
-	"fmt"
-	"strconv"
-)
-
-// A Frame contains part of a call stack.
-type Frame = errors.Frame
-
-// Caller returns a Frame that describes a frame on the caller's stack.
-// The argument skip is the number of frames to skip over.
-// Caller(0) returns the frame for the caller of Caller.
-var Caller func(skip int) Frame = errors.Caller
-
-// FormatError calls the FormatError method of f with an errors.Printer
-// configured according to s and verb, and writes the result to s.
-func FormatError(f Formatter, s fmt.State, verb rune) {
-	// Assuming this function is only called from the Format method, and given
-	// that FormatError takes precedence over Format, it cannot be called from
-	// any package that supports errors.Formatter. It is therefore safe to
-	// disregard that State may be a specific printer implementation and use one
-	// of our choice instead.
-
-	width, okW := s.Width()
-	prec, okP := s.Precision()
-
-	// Construct format string from State s.
-	format := []byte{'%'}
-	if s.Flag('-') {
-		format = append(format, '-')
-	}
-	if s.Flag('+') {
-		format = append(format, '+')
-	}
-	if s.Flag(' ') {
-		format = append(format, ' ')
-	}
-	if okW {
-		format = strconv.AppendInt(format, int64(width), 10)
-	}
-	if okP {
-		format = append(format, '.')
-		format = strconv.AppendInt(format, int64(prec), 10)
-	}
-	format = append(format, string(verb)...)
-	fmt.Fprintf(s, string(format), f)
-}
diff --git a/fmt_test.go b/fmt_test.go
index 5933f18..6744b8a 100644
--- a/fmt_test.go
+++ b/fmt_test.go
@@ -7,6 +7,7 @@
 import (
 	"fmt"
 	"io"
+	"os"
 	"path"
 	"reflect"
 	"regexp"
@@ -90,7 +91,7 @@
 		nonascii = &wrapped{"café", nil}
 		newline  = &wrapped{"msg with\nnewline",
 			&wrapped{"and another\none", nil}}
-		fallback  = &wrapped{"fallback", xerrors.New("file does not exist")}
+		fallback  = &wrapped{"fallback", os.ErrNotExist}
 		oldAndNew = &wrapped{"new style", formatError("old style")}
 		framed    = &withFrameAndMore{
 			frame: xerrors.Caller(0),
@@ -105,13 +106,6 @@
 		want   string
 		regexp bool
 	}{{
-		err: xerrors.New("foo"),
-		fmt: "%+v",
-		want: "foo:" +
-			"\n    golang.org/x/xerrors_test.TestErrorFormatter" +
-			"\n        .+/golang.org/x/xerrors/fmt_test.go:1\\d\\d",
-		regexp: true,
-	}, {
 		err:  simple,
 		fmt:  "%s",
 		want: "simple",
@@ -162,7 +156,7 @@
 		fmt: "%+v",
 		want: "something:" +
 			"\n    golang.org/x/xerrors_test.TestErrorFormatter" +
-			"\n        .+/fmt_test.go:9\\d" +
+			"\n        .+/fmt_test.go:97" +
 			"\n    something more",
 		regexp: true,
 	}, {
@@ -179,10 +173,7 @@
 		// Note: no colon after the last error, as there are no details.
 		want: "fallback:" +
 			"\n    somefile.go:123" +
-			"\n  - file does not exist:" +
-			"\n    golang.org/x/xerrors_test.TestErrorFormatter" +
-			"\n        .+/golang.org/x/xerrors/fmt_test.go:9\\d",
-		regexp: true,
+			"\n  - file does not exist",
 	}, {
 		err:  opaque,
 		fmt:  "%s",
@@ -290,12 +281,12 @@
 		err:  simple,
 		fmt:  "%T",
 		want: "*xerrors_test.wrapped",
-		// }, {
-		// 	// The behavior for this case is different between go1.12 and go1.13.
-		// 	err:  simple,
-		// 	fmt:  "%🤪",
-		// 	want: "%!🤪(*xerrors_test.wrapped=&{simple <nil>})", // go1.12
-		// 	want: "&{%!🤪(string=simple) <nil>}",                // go1.13
+	}, {
+		err:  simple,
+		fmt:  "%🤪",
+		want: "%!🤪(*xerrors_test.wrapped)",
+		// For 1.13:
+		//  want: "%!🤪(*xerrors_test.wrapped=&{simple <nil>})",
 	}, {
 		err:  formatError("use fmt.Formatter"),
 		fmt:  "%#v",
diff --git a/format_go1_12.go b/format.go
similarity index 97%
rename from format_go1_12.go
rename to format.go
index ba856fe..1bc9c26 100644
--- a/format_go1_12.go
+++ b/format.go
@@ -2,8 +2,6 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build !go1.13
-
 package xerrors
 
 // A Formatter formats error messages.
diff --git a/format_go1_13.go b/format_go1_13.go
deleted file mode 100644
index 95c6596..0000000
--- a/format_go1_13.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2018 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.
-
-// +build go1.13
-
-package xerrors
-
-import "errors"
-
-// A Formatter formats error messages.
-type Formatter = errors.Formatter
-
-// A Printer formats error messages.
-//
-// The most common implementation of Printer is the one provided by package fmt
-// during Printf (as of Go 1.13). Localization packages such as golang.org/x/text/message
-// typically provide their own implementations.
-type Printer = errors.Printer
diff --git a/frame_go1_12.go b/frame.go
similarity index 98%
rename from frame_go1_12.go
rename to frame.go
index 6740f7f..0de628e 100644
--- a/frame_go1_12.go
+++ b/frame.go
@@ -2,8 +2,6 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build !go1.13
-
 package xerrors
 
 import (