diff options
| author | Cherry Zhang <cherryyz@google.com> | 2020-08-21 14:18:06 -0400 |
|---|---|---|
| committer | Cherry Zhang <cherryyz@google.com> | 2020-08-21 14:18:06 -0400 |
| commit | 0ef562592fe05b50b0ae8fce495ee7e2eec791f0 (patch) | |
| tree | d1c0f668e473ebdcb4a30e190008043bdb223bd9 /src/runtime/string.go | |
| parent | ac5c406ef0ab20e2a11f57470271266ef4265221 (diff) | |
| parent | 9679b307334bce77cc6e50751956a4c717e9458c (diff) | |
| download | go-0ef562592fe05b50b0ae8fce495ee7e2eec791f0.tar.xz | |
[dev.link] all: merge branch 'master' into dev.link
Change-Id: Ic66b5138f3ecd9e9a48d7ab05782297c06e4a5b5
Diffstat (limited to 'src/runtime/string.go')
| -rw-r--r-- | src/runtime/string.go | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/runtime/string.go b/src/runtime/string.go index 0515b56573..9a601f0094 100644 --- a/src/runtime/string.go +++ b/src/runtime/string.go @@ -335,22 +335,6 @@ func gostringn(p *byte, l int) string { return s } -func index(s, t string) int { - if len(t) == 0 { - return 0 - } - for i := 0; i < len(s); i++ { - if s[i] == t[0] && hasPrefix(s[i:], t) { - return i - } - } - return -1 -} - -func contains(s, t string) bool { - return index(s, t) >= 0 -} - func hasPrefix(s, prefix string) bool { return len(s) >= len(prefix) && s[:len(prefix)] == prefix } @@ -499,37 +483,3 @@ func gostringw(strw *uint16) string { b[n2] = 0 // for luck return s[:n2] } - -// parseRelease parses a dot-separated version number. It follows the -// semver syntax, but allows the minor and patch versions to be -// elided. -func parseRelease(rel string) (major, minor, patch int, ok bool) { - // Strip anything after a dash or plus. - for i := 0; i < len(rel); i++ { - if rel[i] == '-' || rel[i] == '+' { - rel = rel[:i] - break - } - } - - next := func() (int, bool) { - for i := 0; i < len(rel); i++ { - if rel[i] == '.' { - ver, ok := atoi(rel[:i]) - rel = rel[i+1:] - return ver, ok - } - } - ver, ok := atoi(rel) - rel = "" - return ver, ok - } - if major, ok = next(); !ok || rel == "" { - return - } - if minor, ok = next(); !ok || rel == "" { - return - } - patch, ok = next() - return -} |
