diff options
| author | Marvin Stenger <marvin.stenger94@gmail.com> | 2017-10-05 15:49:32 +0200 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2017-10-05 23:19:10 +0000 |
| commit | 90d71fe99e21b68e292327c966946f1706d66514 (patch) | |
| tree | 1eb63d7ee1c5bf5be76b5a69364416603597f573 /src/encoding | |
| parent | 7e31d9b9f7e8e4e72472cfcbd807b5672806635a (diff) | |
| download | go-90d71fe99e21b68e292327c966946f1706d66514.tar.xz | |
all: revert "all: prefer strings.IndexByte over strings.Index"
This reverts https://golang.org/cl/65930.
Fixes #22148
Change-Id: Ie0712621ed89c43bef94417fc32de9af77607760
Reviewed-on: https://go-review.googlesource.com/68430
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/encoding')
| -rw-r--r-- | src/encoding/json/tags.go | 4 | ||||
| -rw-r--r-- | src/encoding/xml/typeinfo.go | 2 | ||||
| -rw-r--r-- | src/encoding/xml/xml.go | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/encoding/json/tags.go b/src/encoding/json/tags.go index 6a8d03a5df..c38fd5102f 100644 --- a/src/encoding/json/tags.go +++ b/src/encoding/json/tags.go @@ -15,7 +15,7 @@ type tagOptions string // parseTag splits a struct field's json tag into its name and // comma-separated options. func parseTag(tag string) (string, tagOptions) { - if idx := strings.IndexByte(tag, ','); idx != -1 { + if idx := strings.Index(tag, ","); idx != -1 { return tag[:idx], tagOptions(tag[idx+1:]) } return tag, tagOptions("") @@ -31,7 +31,7 @@ func (o tagOptions) Contains(optionName string) bool { s := string(o) for s != "" { var next string - i := strings.IndexByte(s, ',') + i := strings.Index(s, ",") if i >= 0 { s, next = s[:i], s[i+1:] } diff --git a/src/encoding/xml/typeinfo.go b/src/encoding/xml/typeinfo.go index b3346d304e..2e7ae935a8 100644 --- a/src/encoding/xml/typeinfo.go +++ b/src/encoding/xml/typeinfo.go @@ -115,7 +115,7 @@ func structFieldInfo(typ reflect.Type, f *reflect.StructField) (*fieldInfo, erro // Split the tag from the xml namespace if necessary. tag := f.Tag.Get("xml") - if i := strings.IndexByte(tag, ' '); i >= 0 { + if i := strings.Index(tag, " "); i >= 0 { finfo.xmlns, tag = tag[:i], tag[i+1:] } diff --git a/src/encoding/xml/xml.go b/src/encoding/xml/xml.go index 27b871649b..be90b62c9a 100644 --- a/src/encoding/xml/xml.go +++ b/src/encoding/xml/xml.go @@ -1161,7 +1161,7 @@ func (d *Decoder) nsname() (name Name, ok bool) { if !ok { return } - i := strings.IndexByte(s, ':') + i := strings.Index(s, ":") if i < 0 { name.Local = s } else { |
