]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cgo: use strings.Contains instead of strings.Index
authorcuiweixie <cuiweixie@gmail.com>
Wed, 28 Sep 2022 13:32:34 +0000 (21:32 +0800)
committerGopher Robot <gobot@golang.org>
Thu, 29 Sep 2022 09:05:02 +0000 (09:05 +0000)
Change-Id: Iaa623dae50ccae36ad44af25899c6453b6108046
Reviewed-on: https://go-review.googlesource.com/c/go/+/435944
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>

src/cmd/cgo/out.go

index e2e2e0b8c5d5fd655ef68531771217135773d013..8736455f4f4b413c05c981c79b5f9a3d08c8e424 100644 (file)
@@ -427,7 +427,7 @@ func checkImportSymName(s string) {
                        fatalf("dynamic symbol %q contains unsupported character", s)
                }
        }
-       if strings.Index(s, "//") >= 0 || strings.Index(s, "/*") >= 0 {
+       if strings.Contains(s, "//") || strings.Contains(s, "/*") {
                fatalf("dynamic symbol %q contains Go comment")
        }
 }