Skip to content

Commit

Permalink
Update CI dependencies (#12)
Browse files Browse the repository at this point in the history
* Update CI dependencies

* Fix error style
  • Loading branch information
fatih authored Feb 16, 2023
1 parent bcedbc3 commit 3360433
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 15 deletions.
43 changes: 33 additions & 10 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,48 @@
name: build
on: [push, pull_request]
jobs:
on:
push:
branches:
- main
pull_request:

jobs:
test-build:
name: Test & Build
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.13
uses: actions/setup-go@v1
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.13
id: go
go-version: '>=1.20.0'

- name: Check out code into the Go module directory
uses: actions/checkout@v1
uses: actions/checkout@v3

- name: Run go mod tidy
run: |
set -e
go mod tidy
output=$(git status -s)
if [ -z "${output}" ]; then
exit 0
fi
echo 'We wish to maintain a tidy state for go mod. Please run `go mod tidy` on your branch, commit and push again.'
echo 'Running `go mod tidy` on this CI test yields with the following changes:'
echo "$output"
exit 1
- name: Test
run: |
go mod tidy -v
go test -race ./...
run: go test -race ./...

- name: Lint
run: "go vet ./..."

- name: Staticcheck
uses: dominikh/staticcheck-action@v1.2.0
with:
version: "2023.1.1"
install-go: false

- name: Build
run: go build ./...
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/fatih/motion

go 1.12
go 1.20
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

func main() {
if err := realMain(); err != nil {
fmt.Fprint(os.Stderr, err.Error())
fmt.Fprintf(os.Stderr, "%s\n", err.Error())
os.Exit(1)
}
}
Expand Down Expand Up @@ -83,17 +83,17 @@ func realMain() error {
case "json":
b, err := json.MarshalIndent(&res, "", "\t")
if err != nil {
return fmt.Errorf("JSON error: %s\n", err)
return fmt.Errorf("JSON error: %s", err)
}
os.Stdout.Write(b)
case "vim":
b, err := vim.Marshal(&res)
if err != nil {
return fmt.Errorf("VIM error: %s\n", err)
return fmt.Errorf("VIM error: %s", err)
}
os.Stdout.Write(b)
default:
return fmt.Errorf("wrong -format value: %q.\n", *flagFormat)
return fmt.Errorf("wrong -format value: %q", *flagFormat)
}

return nil
Expand Down

0 comments on commit 3360433

Please sign in to comment.