Skip to content
This repository was archived by the owner on Dec 1, 2021. It is now read-only.

Commit 01fff4b

Browse files
committed
Remove errors.Print (#23)
errors.Print had a number of problems. Firstly, it was hard coded to print to os.Stderr, which made it difficult to test, and hard to write an example test for. Secondly, comments made in issue #20 make it clear that helpers need to have a high bar for inclusion in this package, and something that wrapped errors.Fprint in a way that was hard to test fails that bar. So, Remove errors.Print, which frees the identifier for being reused later, and reduces the size of the package.
1 parent 502e17a commit 01fff4b

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

errors.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ import (
5151
"errors"
5252
"fmt"
5353
"io"
54-
"os"
5554
"runtime"
5655
"strings"
5756
)
@@ -202,7 +201,7 @@ func Cause(err error) error {
202201
return err
203202
}
204203

205-
// Print prints the error to Stderr.
204+
// Fprint prints the error to the supplied writer.
206205
// If the error implements the Causer interface described in Cause
207206
// Print will recurse into the error's cause.
208207
// If the error implements the inteface:
@@ -212,12 +211,6 @@ func Cause(err error) error {
212211
// }
213212
//
214213
// Print will also print the file and line of the error.
215-
func Print(err error) {
216-
Fprint(os.Stderr, err)
217-
}
218-
219-
// Fprint prints the error to the supplied writer.
220-
// The format of the output is the same as Print.
221214
// If err is nil, nothing is printed.
222215
func Fprint(w io.Writer, err error) {
223216
type location interface {

0 commit comments

Comments
 (0)