diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-01 02:41:36 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-01 02:41:36 -0600 |
commit | cf314d3f1f96e2c07b68a7171e27f58c899bcdbb (patch) | |
tree | 85a3e4769700d054a5deaccc71c691645e029b09 /pkg/binstruct/structs.go | |
parent | d6243eb7afd5d9d91686bce2e02c252be456b38c (diff) |
fix
Diffstat (limited to 'pkg/binstruct/structs.go')
-rw-r--r-- | pkg/binstruct/structs.go | 6 |
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", |