Skip to content
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

Merged
merged 2 commits into from
Feb 13, 2025
Merged

vendor: update bitbox02-api-go #3176

merged 2 commits into from
Feb 13, 2025

Conversation

benma
Copy link
Contributor

@benma benma commented Feb 12, 2025

go get github.com/BitBoxSwiss/bitbox02-api-go@2b90fad
go mod tidy
go mod vendor

@benma benma requested a review from bznein February 13, 2025 08:45
Copy link
Collaborator

@bznein bznein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@benma
Copy link
Contributor Author

benma commented Feb 13, 2025

@bznein pushed one more commit, pls check again 😇

Comment on lines 292 to 297
var newVersionStr string
if newVersion != nil {
newVersionStr = newVersion.String()
}
canUpgrade := false
if newVersion != nil {
canUpgrade = newVersion.AtLeast(currentVersion) && currentVersion.String() != newVersion.String()
}
Copy link
Collaborator

@bznein bznein Feb 13, 2025

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 :)

Copy link
Contributor Author

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
```
@benma benma merged commit 52f56f9 into BitBoxSwiss:master Feb 13, 2025
8 of 9 checks passed
@benma benma deleted the api-go branch February 13, 2025 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants