From 0005ef31bbc668d2532a611d8d9e7f8340ec4542 Mon Sep 17 00:00:00 2001 From: Jacalz Date: Mon, 30 Sep 2024 21:17:10 +0200 Subject: [PATCH 1/4] Modernise CI infrastructure with Go 1.22 This mainly does two things: - Uses Go 1.22 instead of 1.21 as the highest version (I don't have 1.23 on Fedora 40 yet so did not want to bump to latest just yet). - We now always pull the latest setup-go-faster action in v1 without having to manually change version. --- .github/workflows/license_check.yml | 4 ++-- .github/workflows/mobile_tests.yml | 4 ++-- .github/workflows/platform_tests.yml | 8 ++++---- .github/workflows/static_analysis.yml | 4 ++-- .github/workflows/web_tests.yml | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/license_check.yml b/.github/workflows/license_check.yml index d41c3a6449..bd21560a30 100644 --- a/.github/workflows/license_check.yml +++ b/.github/workflows/license_check.yml @@ -10,9 +10,9 @@ jobs: - uses: actions/checkout@v4 with: persist-credentials: false - - uses: WillAbides/setup-go-faster@v1.13.0 + - uses: WillAbides/setup-go-faster@v1 with: - go-version: '1.21.x' + go-version: '1.22.x' - name: Install lian run: go install lucor.dev/lian@latest diff --git a/.github/workflows/mobile_tests.yml b/.github/workflows/mobile_tests.yml index 4919d08d18..5414654041 100644 --- a/.github/workflows/mobile_tests.yml +++ b/.github/workflows/mobile_tests.yml @@ -9,13 +9,13 @@ jobs: strategy: fail-fast: false matrix: - go-version: ['1.19.x', '1.21.x'] + go-version: ['1.19.x', '1.22.x'] steps: - uses: actions/checkout@v4 with: persist-credentials: false - - uses: WillAbides/setup-go-faster@v1.13.0 + - uses: WillAbides/setup-go-faster@v1 with: go-version: ${{ matrix.go-version }} diff --git a/.github/workflows/platform_tests.yml b/.github/workflows/platform_tests.yml index c56cb7c0a6..d2c50b3da1 100644 --- a/.github/workflows/platform_tests.yml +++ b/.github/workflows/platform_tests.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - go-version: ['1.19.x', '1.21.x'] + go-version: ['1.19.x', '1.22.x'] os: [ubuntu-latest, macos-latest] include: - os: ubuntu-latest @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@v4 with: persist-credentials: false - - uses: WillAbides/setup-go-faster@v1.13.0 + - uses: WillAbides/setup-go-faster@v1 with: go-version: ${{ matrix.go-version }} @@ -51,12 +51,12 @@ jobs: strategy: fail-fast: false matrix: - go-version: ['1.20.x', '1.21.x'] + go-version: ['1.20.x', '1.22.x'] steps: - uses: actions/checkout@v4 with: persist-credentials: false - - uses: WillAbides/setup-go-faster@v1.13.0 + - uses: WillAbides/setup-go-faster@v1 with: go-version: ${{ matrix.go-version }} diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 489c47a755..6acb8cb6fa 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -13,9 +13,9 @@ jobs: - uses: actions/checkout@v4 with: persist-credentials: false - - uses: WillAbides/setup-go-faster@v1.13.0 + - uses: WillAbides/setup-go-faster@v1 with: - go-version: '1.21.x' + go-version: '1.22.x' - name: Get dependencies run: >- diff --git a/.github/workflows/web_tests.yml b/.github/workflows/web_tests.yml index dea71861ae..5f4fe6e52b 100644 --- a/.github/workflows/web_tests.yml +++ b/.github/workflows/web_tests.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v4 with: persist-credentials: false - - uses: WillAbides/setup-go-faster@v1.13.0 + - uses: WillAbides/setup-go-faster@v1 with: go-version: '1.19.x' From c6efac247cb78c91fa1c18cf8b9597a6ce81a5c5 Mon Sep 17 00:00:00 2001 From: Jacalz Date: Mon, 30 Sep 2024 21:29:17 +0200 Subject: [PATCH 2/4] Update CI and code to use Staticcheck v0.5.1 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. --- .github/workflows/static_analysis.yml | 2 +- cmd/fyne/internal/mobile/binres/binres_test.go | 2 +- widget/check_group.go | 2 +- widget/list.go | 4 ++-- widget/radio_group.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 6acb8cb6fa..0a13b58c9b 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -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 diff --git a/cmd/fyne/internal/mobile/binres/binres_test.go b/cmd/fyne/internal/mobile/binres/binres_test.go index f6d5e8e6e3..92fdb67446 100644 --- a/cmd/fyne/internal/mobile/binres/binres_test.go +++ b/cmd/fyne/internal/mobile/binres/binres_test.go @@ -246,7 +246,7 @@ func compareElements(have, want *XML) error { } } if buf.Len() > 0 { - return fmt.Errorf(buf.String()) + return errors.New(buf.String()) } return nil } diff --git a/widget/check_group.go b/widget/check_group.go index 6fc258485e..e2725b35ed 100644 --- a/widget/check_group.go +++ b/widget/check_group.go @@ -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 diff --git a/widget/list.go b/widget/list.go index d640e13cb7..f51d6e3c65 100644 --- a/widget/list.go +++ b/widget/list.go @@ -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++ { @@ -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) } diff --git a/widget/radio_group.go b/widget/radio_group.go index 51944a6740..3cf9bcb11f 100644 --- a/widget/radio_group.go +++ b/widget/radio_group.go @@ -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 From 670a42372fc10416e2feefe045b8eeca972354b2 Mon Sep 17 00:00:00 2001 From: Jacalz Date: Mon, 30 Sep 2024 21:35:32 +0200 Subject: [PATCH 3/4] Add a missing import Haven't quite gotten used to Nvim yet ;) --- cmd/fyne/internal/mobile/binres/binres_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/fyne/internal/mobile/binres/binres_test.go b/cmd/fyne/internal/mobile/binres/binres_test.go index 92fdb67446..4a410885dc 100644 --- a/cmd/fyne/internal/mobile/binres/binres_test.go +++ b/cmd/fyne/internal/mobile/binres/binres_test.go @@ -8,6 +8,7 @@ import ( "bytes" "encoding" "encoding/xml" + "errors" "fmt" "math" "os" From 4398262e044a2ea1cee7d1d0fea2bdcf147e47c9 Mon Sep 17 00:00:00 2001 From: Jacalz Date: Mon, 30 Sep 2024 21:38:52 +0200 Subject: [PATCH 4/4] Bump Go version in CI to 1.23 This should be safer than ever given that some new features are dependent on the version in go.mod. --- .github/workflows/license_check.yml | 2 +- .github/workflows/mobile_tests.yml | 2 +- .github/workflows/platform_tests.yml | 2 +- .github/workflows/static_analysis.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/license_check.yml b/.github/workflows/license_check.yml index bd21560a30..c859a6699d 100644 --- a/.github/workflows/license_check.yml +++ b/.github/workflows/license_check.yml @@ -12,7 +12,7 @@ jobs: persist-credentials: false - uses: WillAbides/setup-go-faster@v1 with: - go-version: '1.22.x' + go-version: '1.23.x' - name: Install lian run: go install lucor.dev/lian@latest diff --git a/.github/workflows/mobile_tests.yml b/.github/workflows/mobile_tests.yml index 5414654041..65aeead2bf 100644 --- a/.github/workflows/mobile_tests.yml +++ b/.github/workflows/mobile_tests.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - go-version: ['1.19.x', '1.22.x'] + go-version: ['1.19.x', '1.23.x'] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/platform_tests.yml b/.github/workflows/platform_tests.yml index d2c50b3da1..6644219cf8 100644 --- a/.github/workflows/platform_tests.yml +++ b/.github/workflows/platform_tests.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - go-version: ['1.19.x', '1.22.x'] + go-version: ['1.19.x', '1.23.x'] os: [ubuntu-latest, macos-latest] include: - os: ubuntu-latest diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 0a13b58c9b..8c2cb77a78 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -15,7 +15,7 @@ jobs: persist-credentials: false - uses: WillAbides/setup-go-faster@v1 with: - go-version: '1.22.x' + go-version: '1.23.x' - name: Get dependencies run: >-