If a user defines an AddFlags method which does not have a pointer receiver, it will not properly bind the flag to the value on the object but rather an ephemeral memory location. It also is simply not being called at the moment. An example of this causing a problem in syft where the --key flag was not bound can be seen here. Realistically, this is always a coding problem that needs to be fixed and we should panic if we find AddFlags methods that were incorrectly specified so a user can more quickly get these fixed; i.e. panic if methods seen like this:
func (o Attest) AddFlags(flags fangs.FlagSet) {
...
}
... instead of this:
func (o *Attest) AddFlags(flags fangs.FlagSet) {
...
}
If a user defines an
AddFlags
method which does not have a pointer receiver, it will not properly bind the flag to the value on the object but rather an ephemeral memory location. It also is simply not being called at the moment. An example of this causing a problem in syft where the--key
flag was not bound can be seen here. Realistically, this is always a coding problem that needs to be fixed and we shouldpanic
if we findAddFlags
methods that were incorrectly specified so a user can more quickly get these fixed; i.e. panic if methods seen like this:... instead of this: