You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the API functions in GnoMobile returns key info which includes the key type. This is defined in types.go:
// KeyType reflects a human-readable type for key listing.
type KeyType uint
// Info KeyTypes
const (
TypeLocal KeyType = 0
TypeLedger KeyType = 1
TypeOffline KeyType = 2
TypeMulti KeyType = 3
)
If we use KeyType for a field in a Go struct, then the Protobuf definition made by amino is just an integer. The useful names like "Local" and "Ledger" are lost. The related Protobuf enum would be:
This is the exact inverse of what it would be nice for amino to do. Issue #1157 asks a related question about preserving comments from the Go struct definition, which is difficult because the Go reflection of the struct type doesn't have comments. A proposed solution to that issue is to parse the original Go code into an AST and extract the comments. Perhaps at the same time that amino is extracting comments it could notice that a type alias like KeyType is being used as an enum and produce the Protobuf enum.
If this solution (or a better one) seems desirable, we (Berty devs) could work on a pull request with a little help.
The text was updated successfully, but these errors were encountered:
One of the API functions in GnoMobile returns key info which includes the key type. This is defined in types.go:
If we use
KeyType
for a field in a Go struct, then the Protobuf definition made by amino is just an integer. The useful names like "Local" and "Ledger" are lost. The related Protobuf enum would be:But amino doesn't created this enum. Interestingly, the Protobuf compiler converts this enum into the following Go code:
This is the exact inverse of what it would be nice for amino to do. Issue #1157 asks a related question about preserving comments from the Go struct definition, which is difficult because the Go reflection of the struct type doesn't have comments. A proposed solution to that issue is to parse the original Go code into an AST and extract the comments. Perhaps at the same time that amino is extracting comments it could notice that a type alias like KeyType is being used as an enum and produce the Protobuf enum.
If this solution (or a better one) seems desirable, we (Berty devs) could work on a pull request with a little help.
The text was updated successfully, but these errors were encountered: