1
0
mirror of https://github.com/golang/go synced 2024-11-22 03:14:41 -07:00

Use strings.Contains in src/cmd/...

R=r
CC=golang-dev, r2, rsc
https://golang.org/cl/2819041
This commit is contained in:
Brad Fitzpatrick 2010-11-01 15:21:35 -07:00 committed by Rob Pike
parent 7996924c89
commit b0afb931a8
2 changed files with 5 additions and 5 deletions

View File

@ -223,14 +223,14 @@ func (p *Package) guessKinds(f *File) []*Name {
switch { switch {
default: default:
continue continue
case strings.Index(line, ": useless type name in empty declaration") >= 0: case strings.Contains(line, ": useless type name in empty declaration"):
what = "type" what = "type"
isConst[i] = false isConst[i] = false
case strings.Index(line, ": statement with no effect") >= 0: case strings.Contains(line, ": statement with no effect"):
what = "not-type" // const or func or var what = "not-type" // const or func or var
case strings.Index(line, "undeclared") >= 0: case strings.Contains(line, "undeclared"):
error(noPos, "%s", strings.TrimSpace(line[colon+1:])) error(noPos, "%s", strings.TrimSpace(line[colon+1:]))
case strings.Index(line, "is not an integer constant") >= 0: case strings.Contains(line, "is not an integer constant"):
isConst[i] = false isConst[i] = false
continue continue
} }

View File

@ -38,7 +38,7 @@ var launchpad = regexp.MustCompile(`^(launchpad\.net/([a-z0-9A-Z_.\-]+(/[a-z0-9A
// download checks out or updates pkg from the remote server. // download checks out or updates pkg from the remote server.
func download(pkg string) (string, os.Error) { func download(pkg string) (string, os.Error) {
if strings.Index(pkg, "..") >= 0 { if strings.Contains(pkg, "..") {
return "", os.ErrorString("invalid path (contains ..)") return "", os.ErrorString("invalid path (contains ..)")
} }
if m := bitbucket.FindStringSubmatch(pkg); m != nil { if m := bitbucket.FindStringSubmatch(pkg); m != nil {