-
Notifications
You must be signed in to change notification settings - Fork 2
48 lines (39 loc) · 1.21 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Lint
on:
push:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.13
- name: Check gofmt
run: |
GOFMT_OUT="$(gofmt -d .)"
if [[ -n "${GOFMT_OUT}" ]]; then
echo "Gofmt changes:"
echo "${GOFMT_OUT}"
exit 2
fi
- name: Install golint
run: go get golang.org/x/lint/golint
- name: Run golint for internal testing
run: golint ./... | go run main.go golint --verbose
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
- name: Install addlicense
run: go get github.com/google/addlicense@v0.0.0-20200109101052-9fa18aaf59fb
- name: Check .go files have license headers
run: |
git reset --hard HEAD
addlicense -c "Rover.com" -l mit **/*.go
GIT_DIFF="$(git diff --name-only)"
if [[ -n "${GIT_DIFF}" ]]; then
echo "License headers needed (run 'addlicense -c "Rover.com" -l mit **/*.go' and commit):"
echo "${GIT_DIFF}"
exit 2
fi