Closed luckcolors closed 5 years ago
I think instead of implementing it as a field of size 0, you should just not insert ignored fields into the fields list during parse (in parse.go:parseFieldsLocked, if type is ignore, just skip it).
This will require parseFieldsLocked to use a capacity sized array instead of length, like:
``
And use append instead of fields[i] =
- fields[i] = f
+ fields = append(fields, f)
Iād also prefer to have a test for this, at least with the ignored field by itself, an ignored field before some other fields, at the end of the struct after some other fields, and multiple ignored fields interleaved throughout several fields. struc has pretty high test coverage and Iād like to keep it that way :)
Deleted in favor of usage of the already undocumented and implemented "skip" field tag.
Solves #3 . Let me know what you think. š