-
Notifications
You must be signed in to change notification settings - Fork 5.7k
35 lines (34 loc) · 1.14 KB
/
lint-golang.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
name: Lint GoLang
on: # yamllint disable-line rule:truthy
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
golangci:
name: Lint GoLang
runs-on: ubuntu-latest
steps:
- name: Checkout files
uses: actions/checkout@v4
with:
sparse-checkout: |
.github
gov2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@e9772d140489982e0e3704fea5ee93d536f1e275
with:
files: "gov2/**/*.go"
- uses: actions/setup-go@v3
if: steps.changed-files.outputs.any_changed == 'true'
with:
go-version: 1.21
- name: install golangci-lint
if: steps.changed-files.outputs.any_changed == 'true'
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0
- name: run golangci-lint
if: steps.changed-files.outputs.any_changed == 'true'
run: | # If you get a linting error of "File is not `goimports`-ed", the solution is to run "gofmt -w ./<folder>".
cd gov2
./lint_all_go.sh