diff --git a/skylab/templates/golang.go.tmpl b/skylab/templates/golang.go.tmpl index 42a5eee..d09e9ec 100644 --- a/skylab/templates/golang.go.tmpl +++ b/skylab/templates/golang.go.tmpl @@ -118,13 +118,13 @@ func FromCanFrame(id uint32, data []byte) (Packet, error) { {{- range $p := .Packets }} {{- if $p.Repeat }} case {{ Nx (int $p.Id) $p.Repeat $p.Offset | mapf "0x%X" | strJoin ", " -}}: - var res *{{camelCase $p.Name true}} + var res = &{{camelCase $p.Name true}}{} res.UnmarshalPacket(data) res.Idx = id - {{$p.Id | printf "0x%X" }} return res, nil {{- else }} case {{ $p.Id | printf "0x%X" }}: - var res *{{camelCase $p.Name true}} + var res = &{{camelCase $p.Name true}}{} res.UnmarshalPacket(data) return res, nil {{- end}}