Update proto file and fix protoc version parsing

The new protoc cli return version v23.1,
so we parse the file version v4.23.1 without "4."
This commit is contained in:
yuhan6665 2023-05-21 12:03:42 -04:00
parent c9f517108c
commit d11d72be6c
73 changed files with 238 additions and 205 deletions

View file

@ -108,7 +108,7 @@ func getProjectProtocVersion(url string) (string, error) {
if err != nil {
return "", fmt.Errorf("can not read from body")
}
versionRegexp := regexp.MustCompile(`\/\/\s*protoc\s*v(\d+\.\d+\.\d+)`)
versionRegexp := regexp.MustCompile(`\/\/\s*protoc\s*v\d+\.(\d+\.\d+)`)
matched := versionRegexp.FindStringSubmatch(string(body))
return matched[1], nil
}
@ -120,7 +120,7 @@ func getInstalledProtocVersion(protocPath string) (string, error) {
if cmdErr != nil {
return "", cmdErr
}
versionRegexp := regexp.MustCompile(`protoc\s*(\d+\.\d+\.\d+)`)
versionRegexp := regexp.MustCompile(`protoc\s*(\d+\.\d+)`)
matched := versionRegexp.FindStringSubmatch(string(output))
return matched[1], nil
}