Const sized byte array fail to generate
This is fine:
type Address [20]byte
This blows up with byte array definition not understood by go/ast
const AddressLength = 20
type Address [AddressLength]byte
Do you have a repro of the issue? It does work for me here.
@ferranbt I'm encountering a different flavor of the issue @karalabe described above,
in your example you are defining the 3 - array size constant Issue164ElemSize, type Issue164Elem, struct Issue164 - all in the same package
if I try to use a constant from different (external) package - corresponds to Issue164ElemSize from your example - generator does produce _encoding.go file for me without errors, but the issue is it treats my array as slice (not constant size array!) - obviously failing to compile unless I adjust it manually.
Potentially somewhat related to https://github.com/ferranbt/fastssz/issues/179
Can you share a small repro of the issue?
What's also curious is that latest version seems to be 0.1.3 while 0.1.4 seems to have been out for a while now as per https://github.com/ferranbt/fastssz/tags
➜ go install github.com/ferranbt/fastssz/sszgen@latest
...
➜ sszgen version
0.1.3
Simple example, github.com/attestantio/go-eth2-client/spec/bellatrix I'm using is just an arbitrary external package:
package storage
import "github.com/attestantio/go-eth2-client/spec/bellatrix"
//go:generate sszgen -path ./shares.go --objs storageShare
type storageShare struct {
// Encoding generated will be for slice and not array
FeeRecipientAddress [bellatrix.ExecutionAddressLength]byte
}