allow english plurals with "es" suffix
This commit is contained in:
parent
25f2b0fc35
commit
95d8d105e7
|
@ -34,6 +34,7 @@ func ValidProtobuf(filename string) (string, string, error) {
|
|||
filebase := strings.TrimSuffix(filename, ".proto")
|
||||
base := cases.Title(language.English, cases.NoLower).String(filebase)
|
||||
pluralBase := base + "s" // to conform to autogenpb, it must have an added 's'
|
||||
pluralBase2 := base + "es" // english is annoying, so allow this too
|
||||
|
||||
file, err := os.Open(filename)
|
||||
if err != nil {
|
||||
|
@ -45,11 +46,14 @@ func ValidProtobuf(filename string) (string, string, error) {
|
|||
line := scanner.Text()
|
||||
|
||||
prefix := "message " + pluralBase + " {"
|
||||
if !strings.HasPrefix(line, prefix) {
|
||||
prefix = "message " + pluralBase2 + " {"
|
||||
if !strings.HasPrefix(line, prefix) {
|
||||
// log.Info("nope", prefix, "line", line)
|
||||
// nope, not this line
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
scanner.Scan()
|
||||
line = scanner.Text()
|
||||
|
|
Loading…
Reference in New Issue