Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Diffy McDiffface
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
You can’t perform that action at this time.