Skip to content

Commit

Permalink
Update CI and code to use Staticcheck v0.5.1
Browse files Browse the repository at this point in the history
This fixes a few code errors that slipped through review (thankfully now
handled by Staticcheck for us) and makes sure we are using the latest
version.
  • Loading branch information
Jacalz committed Sep 30, 2024
1 parent 0005ef3 commit c6efac2
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: |
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
go install honnef.co/go/tools/cmd/staticcheck@v0.4.6
go install honnef.co/go/tools/cmd/staticcheck@v0.5.1
go install github.com/mattn/goveralls@latest
- name: Vet
Expand Down
2 changes: 1 addition & 1 deletion cmd/fyne/internal/mobile/binres/binres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func compareElements(have, want *XML) error {
}
}
if buf.Len() > 0 {
return fmt.Errorf(buf.String())
return errors.New(buf.String())

Check failure on line 249 in cmd/fyne/internal/mobile/binres/binres_test.go

View workflow job for this annotation

GitHub Actions / windows_tests (1.20.x)

undefined: errors

Check failure on line 249 in cmd/fyne/internal/mobile/binres/binres_test.go

View workflow job for this annotation

GitHub Actions / mobile_tests (1.19.x)

undefined: errors

Check failure on line 249 in cmd/fyne/internal/mobile/binres/binres_test.go

View workflow job for this annotation

GitHub Actions / mobile_tests (1.22.x)

undefined: errors

Check failure on line 249 in cmd/fyne/internal/mobile/binres/binres_test.go

View workflow job for this annotation

GitHub Actions / platform_tests (1.19.x, ubuntu-latest)

undefined: errors

Check failure on line 249 in cmd/fyne/internal/mobile/binres/binres_test.go

View workflow job for this annotation

GitHub Actions / windows_tests (1.22.x)

undefined: errors

Check failure on line 249 in cmd/fyne/internal/mobile/binres/binres_test.go

View workflow job for this annotation

GitHub Actions / platform_tests (1.19.x, macos-latest)

undefined: errors

Check failure on line 249 in cmd/fyne/internal/mobile/binres/binres_test.go

View workflow job for this annotation

GitHub Actions / platform_tests (1.22.x, ubuntu-latest)

undefined: errors

Check failure on line 249 in cmd/fyne/internal/mobile/binres/binres_test.go

View workflow job for this annotation

GitHub Actions / platform_tests (1.22.x, macos-latest)

undefined: errors
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion widget/check_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ type checkGroupRenderer struct {
// Layout the components of the checks widget
func (r *checkGroupRenderer) Layout(_ fyne.Size) {
count := 1
if r.items != nil && len(r.items) > 0 {
if len(r.items) > 0 {
count = len(r.items)
}
var itemHeight, itemWidth float32
Expand Down
4 changes: 2 additions & 2 deletions widget/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (l *List) scrollTo(id ListItemID) {
separatorThickness := l.Theme().Size(theme.SizeNamePadding)
y := float32(0)
lastItemHeight := l.itemMin.Height
if l.itemHeights == nil || len(l.itemHeights) == 0 {
if len(l.itemHeights) == 0 {
y = (float32(id) * l.itemMin.Height) + (float32(id) * separatorThickness)
} else {
for i := 0; i < id; i++ {
Expand Down Expand Up @@ -368,7 +368,7 @@ func (l *List) contentMinSize() fyne.Size {
}
items := l.Length()

if l.itemHeights == nil || len(l.itemHeights) == 0 {
if len(l.itemHeights) == 0 {
return fyne.NewSize(l.itemMin.Width,
(l.itemMin.Height+separatorThickness)*float32(items)-separatorThickness)
}
Expand Down
2 changes: 1 addition & 1 deletion widget/radio_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ type radioGroupRenderer struct {
// Layout the components of the radio widget
func (r *radioGroupRenderer) Layout(_ fyne.Size) {
count := 1
if r.items != nil && len(r.items) > 0 {
if len(r.items) > 0 {
count = len(r.items)
}
var itemHeight, itemWidth float32
Expand Down

0 comments on commit c6efac2

Please sign in to comment.