From 95d8d105e7e898cf1612e0b43b9a34ef6b1d44dd Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 23 Sep 2025 07:43:40 -0500 Subject: [PATCH] allow english plurals with "es" suffix --- protoc.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/protoc.go b/protoc.go index 01012cb..b37e50e 100644 --- a/protoc.go +++ b/protoc.go @@ -33,7 +33,8 @@ This returns (UUID, Version, error on failure) 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' + 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 { @@ -46,9 +47,12 @@ func ValidProtobuf(filename string) (string, string, error) { prefix := "message " + pluralBase + " {" if !strings.HasPrefix(line, prefix) { - // log.Info("nope", prefix, "line", line) - // nope, not this line - continue + prefix = "message " + pluralBase2 + " {" + if !strings.HasPrefix(line, prefix) { + // log.Info("nope", prefix, "line", line) + // nope, not this line + continue + } } scanner.Scan()