Skip to content

Commit 3360433

Browse files
authored
Update CI dependencies (#12)
* Update CI dependencies * Fix error style
1 parent bcedbc3 commit 3360433

File tree

3 files changed

+38
-15
lines changed

3 files changed

+38
-15
lines changed

.github/workflows/go.yml

+33-10
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,48 @@
11
name: build
2-
on: [push, pull_request]
3-
jobs:
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
47

8+
jobs:
59
test-build:
610
name: Test & Build
711
runs-on: ubuntu-latest
812
steps:
913

10-
- name: Set up Go 1.13
11-
uses: actions/setup-go@v1
14+
- name: Set up Go
15+
uses: actions/setup-go@v3
1216
with:
13-
go-version: 1.13
14-
id: go
17+
go-version: '>=1.20.0'
1518

1619
- name: Check out code into the Go module directory
17-
uses: actions/checkout@v1
20+
uses: actions/checkout@v3
21+
22+
- name: Run go mod tidy
23+
run: |
24+
set -e
25+
go mod tidy
26+
output=$(git status -s)
27+
if [ -z "${output}" ]; then
28+
exit 0
29+
fi
30+
echo 'We wish to maintain a tidy state for go mod. Please run `go mod tidy` on your branch, commit and push again.'
31+
echo 'Running `go mod tidy` on this CI test yields with the following changes:'
32+
echo "$output"
33+
exit 1
1834
1935
- name: Test
20-
run: |
21-
go mod tidy -v
22-
go test -race ./...
36+
run: go test -race ./...
37+
38+
- name: Lint
39+
run: "go vet ./..."
40+
41+
- name: Staticcheck
42+
uses: dominikh/[email protected]
43+
with:
44+
version: "2023.1.1"
45+
install-go: false
2346

2447
- name: Build
2548
run: go build ./...

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module github.com/fatih/motion
22

3-
go 1.12
3+
go 1.20

main.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
func main() {
1616
if err := realMain(); err != nil {
17-
fmt.Fprint(os.Stderr, err.Error())
17+
fmt.Fprintf(os.Stderr, "%s\n", err.Error())
1818
os.Exit(1)
1919
}
2020
}
@@ -83,17 +83,17 @@ func realMain() error {
8383
case "json":
8484
b, err := json.MarshalIndent(&res, "", "\t")
8585
if err != nil {
86-
return fmt.Errorf("JSON error: %s\n", err)
86+
return fmt.Errorf("JSON error: %s", err)
8787
}
8888
os.Stdout.Write(b)
8989
case "vim":
9090
b, err := vim.Marshal(&res)
9191
if err != nil {
92-
return fmt.Errorf("VIM error: %s\n", err)
92+
return fmt.Errorf("VIM error: %s", err)
9393
}
9494
os.Stdout.Write(b)
9595
default:
96-
return fmt.Errorf("wrong -format value: %q.\n", *flagFormat)
96+
return fmt.Errorf("wrong -format value: %q", *flagFormat)
9797
}
9898

9999
return nil

0 commit comments

Comments
 (0)