]> Cypherpunks repositories - gostls13.git/commitdiff
Use strings.Contains in src/cmd/...
authorBrad Fitzpatrick <brad@danga.com>
Mon, 1 Nov 2010 22:21:35 +0000 (15:21 -0700)
committerRob Pike <r@golang.org>
Mon, 1 Nov 2010 22:21:35 +0000 (15:21 -0700)
R=r
CC=golang-dev, r2, rsc
https://golang.org/cl/2819041

src/cmd/cgo/gcc.go
src/cmd/goinstall/download.go

index 777e00bb8fb479ebd5f1f56cac64e541183a5d5f..f17ac1b934f5e04a2447df26cd273f6da10215ee 100644 (file)
@@ -223,14 +223,14 @@ func (p *Package) guessKinds(f *File) []*Name {
                switch {
                default:
                        continue
-               case strings.Index(line, ": useless type name in empty declaration") >= 0:
+               case strings.Contains(line, ": useless type name in empty declaration"):
                        what = "type"
                        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
-               case strings.Index(line, "undeclared") >= 0:
+               case strings.Contains(line, "undeclared"):
                        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
                        continue
                }
index c60d9c41caee686faed7a75a5662c3aabacf0307..76aabb812f12bda06cdfc123b5f34eb861d9c35a 100644 (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.
 func download(pkg string) (string, os.Error) {
-       if strings.Index(pkg, "..") >= 0 {
+       if strings.Contains(pkg, "..") {
                return "", os.ErrorString("invalid path (contains ..)")
        }
        if m := bitbucket.FindStringSubmatch(pkg); m != nil {