Skip to content

Commit 020ef05

Browse files
authored
go.mod: bump to go1.20 (#5)
Update github actions
1 parent afb4d9a commit 020ef05

File tree

3 files changed

+15
-21
lines changed

3 files changed

+15
-21
lines changed

.github/workflows/test.yml

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
# benchmarks. At the end do a quick check to ensure the tests to not leave
2020
# files in the tree.
2121
test:
22-
name: "test: go${{matrix.gover}}.x/${{matrix.os}}"
22+
name: "test: ${{matrix.os}}"
2323
runs-on: "${{matrix.os}}"
2424
continue-on-error: true
2525
defaults:
@@ -29,8 +29,6 @@ jobs:
2929
fail-fast: false
3030
matrix:
3131
os: [ubuntu-latest, macos-latest, windows-latest]
32-
# Do not forget to bump every 6 months!
33-
gover: ["1.19"]
3432
env:
3533
PYTHONDONTWRITEBYTECODE: x
3634
steps:
@@ -40,10 +38,9 @@ jobs:
4038
- uses: actions/checkout@v3
4139
with:
4240
fetch-depth: 2
43-
- uses: actions/setup-go@v3
41+
- uses: actions/setup-go@v4
4442
with:
45-
go-version: "~${{matrix.gover}}.0"
46-
cache: true
43+
go-version-file: go.mod
4744
- name: 'go install necessary tools'
4845
if: always()
4946
run: |
@@ -53,6 +50,7 @@ jobs:
5350
run: go test -timeout=120s -covermode=count -coverprofile coverage.txt -bench=. -benchtime=1x ./...
5451
# Don't send code coverage if anything failed to reduce spam.
5552
- uses: codecov/codecov-action@v2
53+
timeout-minutes: 1
5654
- name: 'Cleanup'
5755
if: always()
5856
run: rm coverage.txt
@@ -87,7 +85,7 @@ jobs:
8785
# to cut on runtime, at the cost of latency. I dislike waiting for results
8886
# so I prefer to run them in parallel.
8987
lint:
90-
name: "lint: go${{matrix.gover}}.x/${{matrix.os}}"
88+
name: "lint: ${{matrix.os}}"
9189
runs-on: "${{matrix.os}}"
9290
continue-on-error: true
9391
defaults:
@@ -100,19 +98,16 @@ jobs:
10098
# OS-specific code benefits from explicitly linting on macOS and
10199
# Windows.
102100
os: [ubuntu-latest, macos-latest, windows-latest]
103-
# Do not forget to bump every 6 months!
104-
gover: ["1.19"]
105101
env:
106102
PYTHONDONTWRITEBYTECODE: x
107103
steps:
108104
- name: Turn off git core.autocrlf
109105
if: matrix.os == 'windows-latest'
110106
run: git config --global core.autocrlf false
111107
- uses: actions/checkout@v3
112-
- uses: actions/setup-go@v3
108+
- uses: actions/setup-go@v4
113109
with:
114-
go-version: "~${{matrix.gover}}.0"
115-
cache: true
110+
go-version-file: go.mod
116111
- name: "Debug"
117112
run: |
118113
echo HOME = $HOME
@@ -226,7 +221,7 @@ jobs:
226221
- name: "Check: go mod tidy doesn't modify files"
227222
if: always()
228223
run: |
229-
go mod tidy -compat=1.17
224+
go mod tidy
230225
TOUCHED=$(git status --porcelain --ignored)
231226
if ! test -z "$TOUCHED"; then
232227
echo "go mod tidy was not clean, please update:"
@@ -266,23 +261,20 @@ jobs:
266261

267262

268263
codeql:
269-
name: "codeql: go${{matrix.gover}}.x/${{matrix.os}}"
264+
name: "codeql: ${{matrix.os}}"
270265
runs-on: "${{matrix.os}}"
271266
continue-on-error: true
272267
strategy:
273268
fail-fast: false
274269
matrix:
275270
os: [ubuntu-latest]
276-
# Do not forget to bump every 6 months!
277-
gover: ["1.19"]
278271
permissions:
279272
security-events: write
280273
steps:
281274
- uses: actions/checkout@v3
282-
- uses: actions/setup-go@v3
275+
- uses: actions/setup-go@v4
283276
with:
284-
go-version: "~${{matrix.gover}}.0"
285-
cache: true
277+
go-version-file: go.mod
286278
- name: Initialize CodeQL
287279
uses: github/codeql-action/init@v2
288280
with:

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
module periph.io/x/cmd
66

7-
go 1.17
7+
go 1.20
88

99
require (
1010
golang.org/x/image v0.1.0

periph-web/web.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ func (s *webServer) api(h interface{}) http.HandlerFunc {
233233
panic("pass func that returns two args")
234234
}
235235
return s.enforceXSRF(func(w http.ResponseWriter, r *http.Request) {
236-
defer r.Body.Close()
236+
defer func() {
237+
_ = r.Body.Close()
238+
}()
237239
if r.Method != "POST" {
238240
http.Error(w, "Only POST is allowed", http.StatusMethodNotAllowed)
239241
return

0 commit comments

Comments
 (0)