-
Notifications
You must be signed in to change notification settings - Fork 91
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
vendor: update bitbox02-api-go #3176
Conversation
benma
commented
Feb 12, 2025
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.
LGTM
@bznein pushed one more commit, pls check again 😇 |
var newVersionStr string | ||
if newVersion != nil { | ||
newVersionStr = newVersion.String() | ||
} | ||
canUpgrade := false | ||
if newVersion != nil { | ||
canUpgrade = newVersion.AtLeast(currentVersion) && currentVersion.String() != newVersion.String() | ||
} |
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 we just move canUpgrade := false
(nit: I think for consistency var canUpgrade bool
would be nicer) above and have everything in a single if?
var newVersionStr string
var canUpgrade bool
if newVersion != nil {
neeVersionStr = newVersion.String()
canUpgrade = newVersion.AtLeast(currentVersion) && currentVersion.String() != newVersionStr
}
(also: wdyt about changing the implementation of String()
in bitbox02-api-go
to add
if version == nil { return "" }
This way we wouldn't need a newVersionStr
. But this might be out of scope for this PR - or even not a good idea :)
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.
Done the first part. I don't think changing String()
is a good idea, as I think normally methods, even on pointer receivers, assume the instance is not nil, so returning ""
there is quite implicit. Explicit > impllicit. Looking at the call site one in that case would look like it would panic.
If no firmware is bundled, don't panic. This is currently the case if connecting a BitBox02 Plus, which does not yet have any firmware bundled in the app.
``` go get github.com/BitBoxSwiss/bitbox02-api-go@2b90fad go mod tidy go mod vendor ```