Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI dependencies #12

Merged
merged 2 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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