Skip to content

Commit

Permalink
Merge pull request #1 from runkecheng/main
Browse files Browse the repository at this point in the history
ci: go fmt and static check.
  • Loading branch information
acekingke authored Jan 19, 2022
2 parents 78667bf + 089cc27 commit 173a172
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/code_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: code check

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:

gofmt:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15

- name: Check out source code
uses: actions/checkout@v1

- name: Run go fmt
run: d="$(gofmt -d ../../)" && if [ -n "$d" ]; then echo "format error:" ; echo "$d"; exit 1; fi

staticcheck:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15

- name: Check out source code
uses: actions/checkout@v1

- name: Install staticcheck
run: go get honnef.co/go/tools/cmd/staticcheck@latest

- name: Run staticcheck
run: staticcheck -f stylish ./...

0 comments on commit 173a172

Please sign in to comment.