File tree 3 files changed +38
-15
lines changed
3 files changed +38
-15
lines changed Original file line number Diff line number Diff line change 1
1
name : build
2
- on : [push, pull_request]
3
- jobs :
2
+ on :
3
+ push :
4
+ branches :
5
+ - main
6
+ pull_request :
4
7
8
+ jobs :
5
9
test-build :
6
10
name : Test & Build
7
11
runs-on : ubuntu-latest
8
12
steps :
9
13
10
- - name : Set up Go 1.13
11
- uses : actions/setup-go@v1
14
+ - name : Set up Go
15
+ uses : actions/setup-go@v3
12
16
with :
13
- go-version : 1.13
14
- id : go
17
+ go-version : ' >=1.20.0'
15
18
16
19
- 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
18
34
19
35
- 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
+
43
+ with :
44
+ version : " 2023.1.1"
45
+ install-go : false
23
46
24
47
- name : Build
25
48
run : go build ./...
Original file line number Diff line number Diff line change 1
1
module github.com/fatih/motion
2
2
3
- go 1.12
3
+ go 1.20
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import (
14
14
15
15
func main () {
16
16
if err := realMain (); err != nil {
17
- fmt .Fprint (os .Stderr , err .Error ())
17
+ fmt .Fprintf (os .Stderr , "%s \n " , err .Error ())
18
18
os .Exit (1 )
19
19
}
20
20
}
@@ -83,17 +83,17 @@ func realMain() error {
83
83
case "json" :
84
84
b , err := json .MarshalIndent (& res , "" , "\t " )
85
85
if err != nil {
86
- return fmt .Errorf ("JSON error: %s\n " , err )
86
+ return fmt .Errorf ("JSON error: %s" , err )
87
87
}
88
88
os .Stdout .Write (b )
89
89
case "vim" :
90
90
b , err := vim .Marshal (& res )
91
91
if err != nil {
92
- return fmt .Errorf ("VIM error: %s\n " , err )
92
+ return fmt .Errorf ("VIM error: %s" , err )
93
93
}
94
94
os .Stdout .Write (b )
95
95
default :
96
- return fmt .Errorf ("wrong -format value: %q. \n " , * flagFormat )
96
+ return fmt .Errorf ("wrong -format value: %q" , * flagFormat )
97
97
}
98
98
99
99
return nil
You can’t perform that action at this time.
0 commit comments