-
Notifications
You must be signed in to change notification settings - Fork 173
proto: Re-enable catching panics in proto library #3059
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 2 files reviewed, 4 unresolved discussions (waiting on @karampok and @oncilla)
go/proto/cereal.go, line 22 at r1 (raw file):
"io" capnp "zombiezen.com/go/capnproto2"
Seems that is being added by my go-import automatically.
Do you understand why?
go/proto/cereal.go, line 113 at r1 (raw file):
return err } return parseStruct(c, s)
Do we use this function? if not maybe delete the implementation
go/proto/cereal_test.go, line 61 at r1 (raw file):
a := &asEntry{} raw := make(common.RawBytes, 1024) n, err := WriteRoot(a, raw)
Ideally your unit test on function ParseFromRaw should not depend on any other function within the file. Maybe you could hardcode the raw (or maybe rewrite the help-testing function)
go/proto/cereal_test.go, line 67 at r1 (raw file):
err = ParseFromRaw(a, raw) } pogsExtractF = test.Extractor
This is confusing to me, I would like more to have the ParseFromRaw
to accept another argument (the function pogsExtractF) for readability. But it is okay to let it like that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r1.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @oncilla)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @karampok)
go/proto/cereal.go, line 113 at r1 (raw file):
Previously, karampok (Konstantinos) wrote…
Do we use this function? if not maybe delete the implementation
Good point.
Done.
go/proto/cereal_test.go, line 61 at r1 (raw file):
Previously, karampok (Konstantinos) wrote…
Ideally your unit test on function ParseFromRaw should not depend on any other function within the file. Maybe you could hardcode the raw (or maybe rewrite the help-testing function)
It is a bit hard to hard-code this.
If we change the proto file for ASEntry, then the unit tests will suddenly fail, which is unexpected.
Also, if WriteRoot does not work as expected, we are in a completely different world of pain :)
go/proto/cereal_test.go, line 67 at r1 (raw file):
Previously, karampok (Konstantinos) wrote…
This is confusing to me, I would like more to have the
ParseFromRaw
to accept another argument (the function pogsExtractF) for readability. But it is okay to let it like that
Yeah. I also don't like the package variable that defines of stuff is extracted.
But I think it was the only way to make this testable without having an API that you suggested.
Note, in normal operation it does not make sense to provide any other extractor function, this is truly just for testing the code and the API exposed by ParseFromRaw
is the correct one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @oncilla)
go/proto/cereal_test.go, line 61 at r1 (raw file):
Previously, Oncilla wrote…
It is a bit hard to hard-code this.
If we change the proto file for ASEntry, then the unit tests will suddenly fail, which is unexpected.
Also, if WriteRoot does not work as expected, we are in a completely different world of pain :)
In theory you could use once the WriteRoot and save to a buffer var the value you need (assuming that now WriteRoot currently works).
I would prefer that mainly because of keeping the files short (fewer lines of code).
But up to you, not strong feeling.
go/proto/cereal_test.go, line 67 at r1 (raw file):
Previously, Oncilla wrote…
Yeah. I also don't like the package variable that defines of stuff is extracted.
But I think it was the only way to make this testable without having an API that you suggested.Note, in normal operation it does not make sense to provide any other extractor function, this is truly just for testing the code and the API exposed by
ParseFromRaw
is the correct one.
fair
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @oncilla)
8dacb7d
to
0ab45b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 2 files reviewed, 2 unresolved discussions (waiting on @karampok)
go/proto/cereal_test.go, line 61 at r1 (raw file):
Previously, karampok (Konstantinos) wrote…
In theory you could use once the WriteRoot and save to a buffer var the value you need (assuming that now WriteRoot currently works).
I would prefer that mainly because of keeping the files short (fewer lines of code).
But up to you, not strong feeling.
Done.
go/proto/cereal_test.go, line 67 at r1 (raw file):
Previously, karampok (Konstantinos) wrote…
fair
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3.
Reviewable status:complete! all files reviewed, all discussions resolved
The recover defer was removed by a code refactor in scionproto#2707.
0ab45b7
to
f8e8a70
Compare
The recover defer was removed by a code refactor in #2707.
This change is