From 4e0116bd0f06534d0e9cb62878bbc5fed34b9a91 Mon Sep 17 00:00:00 2001 From: Andrew Gasparovic <55992101+agasparovic-sabre@users.noreply.github.com> Date: Thu, 30 Apr 2020 21:10:13 -0700 Subject: [PATCH] Don't prefix enums unless namespace-enums is true The -namespace-enums command-line flag doesn't seem to be working because of this. (I've tried it true/false with no effect either way - it always adds prefixes. I can provide a repro if needed.) --- compiler/compiler.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/compiler/compiler.go b/compiler/compiler.go index 45bcfd0..7524d0e 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -489,15 +489,10 @@ func (c *compileCtx) getTypeFromReference(ref string) (protobuf.Type, error) { } func (c *compileCtx) compileEnum(name string, elements []string) (*protobuf.Enum, error) { - var prefix bool - if c.parent() != c.pkg || c.prefixEnums { - prefix = true - } - e := protobuf.NewEnum(camelCase(name)) for _, enum := range elements { ename := enum - if prefix || looksLikeInteger(ename) { + if c.prefixEnums || looksLikeInteger(ename) { ename = name + "_" + ename } ename = normalizeEnumName(ename)