diff options
| author | Jeff Carr <[email protected]> | 2025-10-07 00:45:54 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-07 00:45:54 -0500 |
| commit | 6d3e15dfdff1e1420a92975d78d8dad065e610a0 (patch) | |
| tree | 24cbb54204dd7e39a0b16140fab8e14d45c38299 /findFilename.go | |
| parent | d94113ae104ad5d79302e74a11f5a309a82e34de (diff) | |
panic on lower case filename
Diffstat (limited to 'findFilename.go')
| -rw-r--r-- | findFilename.go | 9 |
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. |
