Skip to content

Commit cc27dd2

Browse files
chore: upgrade to go 1.26 (#610)
* chore: upgrade to go 1.26 * also upgrade version in github actions * pin golangci-lint version * upgrade mockery tool * upgrade codecov action * upgrade codeql action * refactor: optimize command slice initialization in runFinalShellCommands
1 parent dd15110 commit cc27dd2

19 files changed

Lines changed: 98 additions & 41 deletions

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ${{ matrix.os }}
1919
strategy:
2020
matrix:
21-
go_version: ['1.25']
21+
go_version: ['1.26']
2222
os: [ubuntu-latest, windows-latest, macos-latest]
2323
env:
2424
OS: ${{ matrix.os }}
@@ -39,7 +39,7 @@ jobs:
3939
- name: golangci-lint
4040
uses: golangci/golangci-lint-action@v8
4141
with:
42-
version: v2.5.0
42+
version: v2.9.0
4343
args: --timeout=30m
4444

4545
- name: Test
@@ -51,10 +51,10 @@ jobs:
5151
run: make build
5252

5353
- name: Code coverage with codecov
54-
uses: codecov/codecov-action@v4
54+
uses: codecov/codecov-action@v6
5555
with:
5656
env_vars: OS,GO
57-
file: ./coverage.out
57+
files: ./coverage.out
5858
flags: unittests
5959
fail_ci_if_error: false
6060
verbose: true

.github/workflows/codeql.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ jobs:
5353
- name: Set up Go (latest version)
5454
uses: actions/setup-go@v6
5555
with:
56-
go-version: '>=1.25.0'
56+
go-version: '>=1.26.0'
5757
check-latest: true
5858

5959
# Initializes the CodeQL tools for scanning.
6060
- name: Initialize CodeQL
61-
uses: github/codeql-action/init@v3
61+
uses: github/codeql-action/init@v4
6262
with:
6363
languages: ${{ matrix.language }}
6464
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -72,7 +72,7 @@ jobs:
7272
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
7373
# If this step fails, then you should remove it and run the build manually (see below)
7474
- name: Autobuild
75-
uses: github/codeql-action/autobuild@v3
75+
uses: github/codeql-action/autobuild@v4
7676

7777
# ℹ️ Command-line programs to run using the OS shell.
7878
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -85,6 +85,6 @@ jobs:
8585
# ./location_of_script_within_repo/buildscript.sh
8686

8787
- name: Perform CodeQL Analysis
88-
uses: github/codeql-action/analyze@v3
88+
uses: github/codeql-action/analyze@v4
8989
with:
9090
category: "/language:${{matrix.language}}"

.github/workflows/doc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Set up Go
2727
uses: actions/setup-go@v6
2828
with:
29-
go-version: ~1.25
29+
go-version: ~1.26
3030

3131
- name: Check configuration snippets in documentation
3232
run: go run ./config/checkdoc -r docs/content -i changelog.md

.github/workflows/docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Set up Go
2525
uses: actions/setup-go@v6
2626
with:
27-
go-version: ~1.25
27+
go-version: ~1.26
2828
check-latest: true
2929

3030
- name: Set up QEMU
@@ -51,7 +51,7 @@ jobs:
5151
- name: Run GoReleaser
5252
uses: goreleaser/goreleaser-action@v6
5353
with:
54-
version: latest
54+
version: '~> v2'
5555
args: release --clean --config .goreleaser-docker-only.yml
5656
env:
5757
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-doc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Set up Go
2020
uses: actions/setup-go@v6
2121
with:
22-
go-version: ~1.25
22+
go-version: ~1.26
2323

2424
- name: Check configuration snippets in documentation
2525
run: go run ./config/checkdoc -r docs/content -i changelog.md

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Set up Go
2121
uses: actions/setup-go@v6
2222
with:
23-
go-version: ~1.25
23+
go-version: ~1.26
2424
check-latest: true
2525

2626
- name: Set up QEMU
@@ -47,7 +47,7 @@ jobs:
4747
- name: Run GoReleaser
4848
uses: goreleaser/goreleaser-action@v6
4949
with:
50-
version: latest
50+
version: '~> v2'
5151
args: release --clean
5252
env:
5353
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/snapshot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Set up Go
2020
uses: actions/setup-go@v6
2121
with:
22-
go-version: ~1.25
22+
go-version: ~1.26
2323
check-latest: true
2424

2525
- name: Set up QEMU
@@ -46,7 +46,7 @@ jobs:
4646
- name: Run GoReleaser
4747
uses: goreleaser/goreleaser-action@v6
4848
with:
49-
version: latest
49+
version: '~> v2'
5050
args: release --clean --snapshot --config .goreleaser-snapshot.yml
5151
env:
5252
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# Makefile for resticprofile
33
#
4-
GOCMD=go
4+
GOCMD=$(shell command -v go)
55
GOBUILD=$(GOCMD) build
66
GOINSTALL=$(GOCMD) install
77
GORUN=$(GOCMD) run
@@ -75,7 +75,7 @@ all: prepare_test test build
7575
.PHONY: all verify prepare_test prepare_build install clean ramdisk rest-server nightly toc syslog checkdoc
7676

7777
verify: ## Verify go installation
78-
ifeq ($(wildcard $(GOPATH)/.),)
78+
ifeq ($(GOPATH),)
7979
@echo "GOPATH not found, please check your go installation"
8080
exit 1
8181
endif
@@ -94,11 +94,11 @@ $(GOBIN)/github-markdown-toc.go: verify $(GOBIN)/eget
9494

9595
$(GOBIN)/mockery: verify $(GOBIN)/eget
9696
@echo "[*] $@"
97-
"$(GOBIN)/eget" vektra/mockery --tag v3.5.5 --upgrade-only --to '$(GOBIN)'
97+
"$(GOBIN)/eget" vektra/mockery --tag v3.7.0 --upgrade-only --to '$(GOBIN)'
9898

99-
$(GOBIN)/golangci-lint: verify $(GOBIN)/eget
99+
$(GOBIN)/golangci-lint-v2: verify $(GOBIN)/eget
100100
@echo "[*] $@"
101-
"$(GOBIN)/eget" golangci/golangci-lint --tag v2.5.0 --asset=tar.gz --upgrade-only --to '$(GOBIN)'
101+
"$(GOBIN)/eget" golangci/golangci-lint --tag v2.9.0 --asset=tar.gz --upgrade-only --to '$(GOBIN)/golangci-lint-v2'
102102

103103
$(GOBIN)/hugo: $(GOBIN)/eget
104104
@echo "[*] $@"
@@ -321,20 +321,20 @@ checklinks: $(GOBIN)/muffet ## Check for broken links in the documentation site
321321
http://127.0.0.1:1313/resticprofile/
322322

323323
.PHONY: lint
324-
lint: $(GOBIN)/golangci-lint ## Run golangci-lint
324+
lint: $(GOBIN)/golangci-lint-v2 ## Run golangci-lint
325325
@echo "[*] $@"
326-
GOOS=darwin golangci-lint run
327-
GOOS=linux golangci-lint run
328-
GOOS=windows golangci-lint run
326+
GOOS=darwin $(GOBIN)/golangci-lint-v2 run
327+
GOOS=linux $(GOBIN)/golangci-lint-v2 run
328+
GOOS=windows $(GOBIN)/golangci-lint-v2 run
329329

330330
.PHONY: fix
331-
fix: $(GOBIN)/golangci-lint ## Run golangci-lint with --fix
331+
fix: $(GOBIN)/golangci-lint-v2 ## Run golangci-lint with --fix
332332
@echo "[*] $@"
333333
$(GOCMD) mod tidy
334334
$(GOCMD) fix ./...
335-
GOOS=darwin golangci-lint run --fix
336-
GOOS=linux golangci-lint run --fix
337-
GOOS=windows golangci-lint run --fix
335+
GOOS=darwin $(GOBIN)/golangci-lint-v2 run --fix
336+
GOOS=linux $(GOBIN)/golangci-lint-v2 run --fix
337+
GOOS=windows $(GOBIN)/golangci-lint-v2 run --fix
338338

339339
.PHONY: deploy-current
340340
deploy-current: build-linux build-pi

complete_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func TestCompleter(t *testing.T) {
189189
prefix := fmt.Sprintf("%s.", profile)
190190
completions := completer.Complete(newArgs("--config", DevConfig, prefix))
191191

192-
var expected []string
192+
expected := make([]string, 0, len(commands)+1)
193193
for _, commandName := range commands {
194194
expected = append(expected, prefix+commandName)
195195
}

darwin/tree.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func generateTreeOfSchedules(event *calendar.Event) []*treeElement {
3131
}
3232
subTree := getElements(values, currentTypeValue)
3333
if len(*currentElements) > 0 {
34-
newCurrentElements := make([]*treeElement, 0)
34+
newCurrentElements := make([]*treeElement, 0, len(*currentElements)*len(subTree))
3535
for _, element := range *currentElements {
3636
// add each new element to the child of all the current elements
3737
element.subElements = make([]*treeElement, len(subTree))

0 commit comments

Comments
 (0)