Skip to content

Commit d2cf1a2

Browse files
authored
Merge pull request github#13014 from owen-mc/go/misc-go-cleanups
Go: Misc go cleanups
2 parents f2031e4 + 347b5f1 commit d2cf1a2

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,6 @@ func getEnvGoSemVer() string {
9292
return "v" + goVersion[2:]
9393
}
9494

95-
func tryBuild(buildFile, cmd string, args ...string) bool {
96-
if util.FileExists(buildFile) {
97-
log.Printf("%s found, running %s\n", buildFile, cmd)
98-
return util.RunCmd(exec.Command(cmd, args...))
99-
}
100-
return false
101-
}
102-
10395
// Returns the import path of the package being built, or "" if it cannot be determined.
10496
func getImportPath() (importpath string) {
10597
importpath = os.Getenv("LGTM_INDEX_IMPORT_PATH")
@@ -129,7 +121,7 @@ func getImportPath() (importpath string) {
129121
// determined.
130122
func getImportPathFromRepoURL(repourl string) string {
131123
// check for scp-like URL as in "[email protected]:github/codeql-go.git"
132-
shorturl := regexp.MustCompile("^([^@]+@)?([^:]+):([^/].*?)(\\.git)?$")
124+
shorturl := regexp.MustCompile(`^([^@]+@)?([^:]+):([^/].*?)(\.git)?$`)
133125
m := shorturl.FindStringSubmatch(repourl)
134126
if m != nil {
135127
return m[2] + "/" + m[3]
@@ -153,7 +145,7 @@ func getImportPathFromRepoURL(repourl string) string {
153145
host := u.Hostname()
154146
path := u.Path
155147
// strip off leading slashes and trailing `.git` if present
156-
path = regexp.MustCompile("^/+|\\.git$").ReplaceAllString(path, "")
148+
path = regexp.MustCompile(`^/+|\.git$`).ReplaceAllString(path, "")
157149
return host + "/" + path
158150
}
159151

0 commit comments

Comments
 (0)