diff --git a/go/tools/gopackagesdriver/bazel_json_builder.go b/go/tools/gopackagesdriver/bazel_json_builder.go index 763863320c..d123889522 100644 --- a/go/tools/gopackagesdriver/bazel_json_builder.go +++ b/go/tools/gopackagesdriver/bazel_json_builder.go @@ -116,7 +116,9 @@ func (b *BazelJSONBuilder) adjustToRelativePathIfPossible(request string) string func (b *BazelJSONBuilder) packageQuery(importPath string) string { if strings.HasSuffix(importPath, "/...") { - importPath = fmt.Sprintf(`^%s(/.+)?$`, strings.TrimSuffix(importPath, "/...")) + importPath = fmt.Sprintf(`%s(/.+)?$`, regexp.QuoteMeta(strings.TrimSuffix(importPath, "/..."))) + } else { + importPath = regexp.QuoteMeta(importPath) } return fmt.Sprintf(