aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/utf8/string.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-11-01 22:58:09 -0400
committerRuss Cox <rsc@golang.org>2011-11-01 22:58:09 -0400
commit492098eb759bba2ff5c86b0a868158afe32e91f8 (patch)
treefbfa37b0cb08d9143f044d7eb6205352c981bd39 /src/pkg/utf8/string.go
parentabd32609900775043a46a6c97367d079a5597c0a (diff)
downloadgo-492098eb759bba2ff5c86b0a868158afe32e91f8.tar.xz
all: rename os.Error to error in various non-code contexts
R=adg CC=golang-dev https://golang.org/cl/5328062
Diffstat (limited to 'src/pkg/utf8/string.go')
-rw-r--r--src/pkg/utf8/string.go20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/pkg/utf8/string.go b/src/pkg/utf8/string.go
index ce430ba4f5..443decf056 100644
--- a/src/pkg/utf8/string.go
+++ b/src/pkg/utf8/string.go
@@ -4,6 +4,8 @@
package utf8
+import "errors"
+
// String wraps a regular string with a small structure that provides more
// efficient indexing by code point index, as opposed to byte index.
// Scanning incrementally forwards or backwards is O(1) per index operation
@@ -193,19 +195,5 @@ func (s *String) At(i int) rune {
return r
}
-// We want the panic in At(i) to satisfy os.Error, because that's what
-// runtime panics satisfy, but we can't import os. This is our solution.
-
-// error is the type of the error returned if a user calls String.At(i) with i out of range.
-// It satisfies os.Error and runtime.Error.
-type error_ string
-
-func (err error_) String() string {
- return string(err)
-}
-
-func (err error_) RunTimeError() {
-}
-
-var outOfRange = error_("utf8.String: index out of range")
-var sliceOutOfRange = error_("utf8.String: slice index out of range")
+var outOfRange = errors.New("utf8.String: index out of range")
+var sliceOutOfRange = errors.New("utf8.String: slice index out of range")