summaryrefslogtreecommitdiff
path: root/findFilename.go
diff options
context:
space:
mode:
Diffstat (limited to 'findFilename.go')
-rw-r--r--findFilename.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/findFilename.go b/findFilename.go
index c99e289..c605dcb 100644
--- a/findFilename.go
+++ b/findFilename.go
@@ -3,6 +3,7 @@ package config
import (
"fmt"
+ "go.wit.com/log"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
)
@@ -21,13 +22,17 @@ func GetFilename(pb proto.Message) (string, error) {
// 3. Find the specific field descriptor by its protobuf name ("Filename").
// Note: The field name must match the name in the .proto file.
- fieldName := protoreflect.Name("filename")
+ fieldName := protoreflect.Name("Filename")
fieldDescriptor := descriptor.Fields().ByName(fieldName)
// try upper case
if fieldDescriptor == nil {
- fieldName = protoreflect.Name("Filename")
+ fieldName = protoreflect.Name("filename")
fieldDescriptor = descriptor.Fields().ByName(fieldName)
+ if fieldDescriptor != nil {
+ log.Info("")
+ panic(".proto file must have 'Filename', not 'filename'")
+ }
}
// 4. Check if the field was found. If not, return false.