Created
April 7, 2016 11:08
-
-
Save davecheney/0b8e80c62949b42112c942d4fad65d98 to your computer and use it in GitHub Desktop.
Diffy McDiffface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/errors/errors.go b/src/errors/errors.go | |
index b8a4692..ba1e239 100644 | |
--- a/src/errors/errors.go | |
+++ b/src/errors/errors.go | |
@@ -10,6 +10,10 @@ func New(text string) error { | |
return &errorString{text} | |
} | |
+type Error string | |
+ | |
+func (e Error) Error() string { return string(e) } | |
+ | |
// errorString is a trivial implementation of error. | |
type errorString struct { | |
s string | |
diff --git a/src/io/io.go b/src/io/io.go | |
index 23401da..12e5d2e 100644 | |
--- a/src/io/io.go | |
+++ b/src/io/io.go | |
@@ -35,7 +35,7 @@ var ErrShortBuffer = errors.New("short buffer") | |
// If the EOF occurs unexpectedly in a structured data stream, | |
// the appropriate error is either ErrUnexpectedEOF or some other error | |
// giving more detail. | |
-var EOF = errors.New("EOF") | |
+const EOF = errors.Error("EOF") | |
// ErrUnexpectedEOF means that EOF was encountered in the | |
// middle of reading a fixed-size block or data structure. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment