strom: fix generator for pointer-receiver Encode, use nbt.Tag for named NBT
- Delete raw_capture subcommand (use tcpflow + raw-to-tmcpr instead) - Fix DefaultEncoder to use temp variable for non-addressable value encoding, eliminating manual post-generation patches - Map nbt and optionalNbt types to nbt.Tag (named NBT) instead of nbt.Anon (anonymous NBT) — 1.8 uses named NBT with root tag names
This commit is contained in:
@@ -11,15 +11,16 @@ import (
|
||||
"github.com/go-viper/mapstructure/v2"
|
||||
)
|
||||
|
||||
func DefaultEncoder(_ *Generator, varToSet ast.Expr, _ any, _ string) (s []ast.Stmt, err error) {
|
||||
func DefaultEncoder(_ *Generator, varToSet ast.Expr, _ any, name string) (s []ast.Stmt, err error) {
|
||||
tmpName := name + "EncTmp"
|
||||
s = Stmts(
|
||||
Define121(Ident(tmpName), varToSet),
|
||||
Assign121(
|
||||
Ident("err"),
|
||||
Call(SelectorExprAndStr(varToSet, "Encode"), Ident("w")),
|
||||
Call(SelectorExprAndStr(Ident(tmpName), "Encode"), Ident("w")),
|
||||
),
|
||||
IfErrNil(),
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user