Closed Lavishq closed 3 months ago
Sweet, very nice :)
One more thing to make it perfect if you're up for it: tests :D But don't worry, it's easy because the test data is there, it just needs to be called:
SmallTestStruct
and FixedTestStruct
from that second python link into Go as per the first link.go generate
to create the type defs in the test folderIf you're feeling a bit more adventurous, you can also add VarTestStruct
and ComplexTestStruct
, which isn't much harder, just the fields types are not only primitives any more, rather you'll need to dig a bit deeper. But if you don't want to, I'm happy with the first two types only too :)
Attention: Patch coverage is 81.44330%
with 18 lines
in your changes missing coverage. Please review.
Project coverage is 83.85%. Comparing base (
be92ed9
) to head (ba211b5
).
did the tests and able to go generate
w/o errors for
SmallTestStruct
and FixedTestStruct
here
where as having issues getting complex dynamic dtypes work, since idk golang
type VarTestStruct struct {
A [1]byte `ssz-size:"2" ssz:"bits"`
// B [1]byte `ssz-size:"2" ssz:"bits" ssz-max:"1024"`
C [1]byte `ssz-size:"1" ssz:"bits"`
}
type ComplexTestStruct struct {
A [1]byte `ssz-size:"2" ssz:"bits"`
// B [1]byte `ssz-size:"2" ssz:"bits" ssz-max:"128"`
C [1]byte `ssz-size:"1" ssz:"bits"`
// D [1]byte `ssz-max:"256"`
E VarTestStruct
// F [1]FixedTestStruct `ssz-size:"4" ssz:"bits"`
// G [1]VarTestStruct `ssz-size:"2" ssz:"bits"`
}
have reached til^
sorry, if im wrong w/ things since this is the first time im programming in go- so learning while trying this :)`
@Lavishq Just one more tip in general, in Go, you can run all the tests from all packages via go test ./...
. The one you did running go test
only ran it for tests in the root folder, which aren't really many/any. This is generally not the case for Go packages of course, but for this specific project there is such an extensive external test suite, that it made little sense to redo internal unit tests when I could just rely on the external suite.
Thanks again :)
hm, i know nothing about go, i once did tour of go upto variables and imports, probably a little more for about 20-30 mins and that is all [ also dont remember much ] so i do need to learn it the right way, recently was looking at op-geth and didnt understand much, thought that since it is gfg i would quickly learn from gobyexample or the codebase itself ^^
thanks ser, for bearing with me, it was embarrasing to make silly mistakes but was a learning exp and would do again but maybe after i finish tour of go this time :)
https://github.com/karalabe/ssz/issues/12