Skip to content

Commit e96f24f

Browse files
jokemanfirejokemanfire
jokemanfire
authored andcommitted
work/init:Change regular expressions
Fixes #69221 work/init:compilerVersion support multi-language
1 parent a9e6a96 commit e96f24f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cmd/go/internal/work/init.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,10 @@ func compilerVersion() (version, error) {
371371
// gcc, but does not support gcc's "-v" flag?!
372372
return err
373373
}
374-
gccRE := regexp.MustCompile(`gcc version (\d+)\.(\d+)`)
374+
gccRE := regexp.MustCompile(`gcc .+? (\d+)\.(\d+)`)
375375
match = gccRE.FindSubmatch(out)
376376
} else {
377-
clangRE := regexp.MustCompile(`clang version (\d+)\.(\d+)`)
377+
clangRE := regexp.MustCompile(`clang .+? (\d+)\.(\d+)`)
378378
if match = clangRE.FindSubmatch(out); len(match) > 0 {
379379
compiler.name = "clang"
380380
}

0 commit comments

Comments
 (0)