summaryrefslogtreecommitdiff
path: root/pkg/binstruct/structs.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-06-01 02:41:36 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-06-01 02:41:36 -0600
commitcf314d3f1f96e2c07b68a7171e27f58c899bcdbb (patch)
tree85a3e4769700d054a5deaccc71c691645e029b09 /pkg/binstruct/structs.go
parentd6243eb7afd5d9d91686bce2e02c252be456b38c (diff)
fix
Diffstat (limited to 'pkg/binstruct/structs.go')
-rw-r--r--pkg/binstruct/structs.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/binstruct/structs.go b/pkg/binstruct/structs.go
index 7a0c74b..8ecea6a 100644
--- a/pkg/binstruct/structs.go
+++ b/pkg/binstruct/structs.go
@@ -113,6 +113,12 @@ func genStructHandler(structInfo reflect.Type) (structHandler, error) {
for i := 0; i < structInfo.NumField(); i++ {
var fieldInfo reflect.StructField = structInfo.Field(i)
+ if fieldInfo.Anonymous && fieldInfo.Type != endType {
+ err := fmt.Errorf("binstruct does not support embedded fields")
+ return ret, fmt.Errorf("struct %q field %d %q: %w",
+ ret.name, i, fieldInfo.Name, err)
+ }
+
fieldTag, err := parseStructTag(fieldInfo.Tag.Get("bin"))
if err != nil {
return ret, fmt.Errorf("struct %q field %d %q: %w",