-
Notifications
You must be signed in to change notification settings - Fork 95
gen Reset() by default value #315
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
base: master
Are you sure you want to change the base?
Conversation
|
@ondrej-fabry, correct me if I'm wrong, but isn't binapi's default value tag more like an informative, and is it processed on the VPP side? I think we don't need to pre-fill them during the object creation or reset. @fesily is there any specific scenario where you have to fill the default value by hand, otherwise the call fails, or any example where this is an issue? |
|
Yes, you are correct @VladoLavor However, that does not mean we cannot use the value to prefill. We just have not, because most of the times we build the value directly, this solution request a call to |
| "strconv" | ||
| "strings" | ||
|
|
||
| "go.fd.io/govpp/binapi/ethernet_types" |
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.
We should not ever depend on the generate binapi. Especially not in the binapigen. Consider binapi and packages under it as example, not as code to be used inside GoVPP. Even projects using GoVPP should generate their own.
| func fieldActualType(field *Field) (actual string) { | ||
| switch { | ||
| case field.TypeAlias != nil: | ||
| case field.TypeAlias != nil && field.TypeAlias.Length == 0: |
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.
Can you list a case this handles/fixes?
ondrej-fabry
left a comment
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.
You will need to regenerate existing binapi to pass a check.
govpp does not utilise binapi's prompts for default member values.