Skip to content

Commit 509dda5

Browse files
committed
Use raw string literals to avoid double-escaping
1 parent 4de4f35 commit 509dda5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

go/extractor/cli/go-autobuilder/go-autobuilder.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func getImportPath() (importpath string) {
129129
// determined.
130130
func getImportPathFromRepoURL(repourl string) string {
131131
// check for scp-like URL as in "[email protected]:github/codeql-go.git"
132-
shorturl := regexp.MustCompile("^([^@]+@)?([^:]+):([^/].*?)(\\.git)?$")
132+
shorturl := regexp.MustCompile(`^([^@]+@)?([^:]+):([^/].*?)(\.git)?$`)
133133
m := shorturl.FindStringSubmatch(repourl)
134134
if m != nil {
135135
return m[2] + "/" + m[3]
@@ -153,7 +153,7 @@ func getImportPathFromRepoURL(repourl string) string {
153153
host := u.Hostname()
154154
path := u.Path
155155
// strip off leading slashes and trailing `.git` if present
156-
path = regexp.MustCompile("^/+|\\.git$").ReplaceAllString(path, "")
156+
path = regexp.MustCompile(`^/+|\.git$`).ReplaceAllString(path, "")
157157
return host + "/" + path
158158
}
159159

0 commit comments

Comments
 (0)