mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-14 15:56:44 +03:00
49 lines
1.4 KiB
YAML
49 lines
1.4 KiB
YAML
name: Lint
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.20.x
|
|
|
|
- name: Get Go cache paths
|
|
id: go-env
|
|
run: |
|
|
echo "::set-output name=cache::$(go env GOCACHE)"
|
|
echo "::set-output name=modcache::$(go env GOMODCACHE)"
|
|
- name: Set up Go cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
key: golangci-lint-${{ runner.os }}-go-${{ hashFiles('go.mod') }}
|
|
restore-keys: golangci-lint-${{ runner.os }}-go-
|
|
path: |
|
|
${{ steps.go-env.outputs.cache }}
|
|
${{ steps.go-env.outputs.modcache }}
|
|
|
|
- name: Install golangci-lint
|
|
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0
|
|
|
|
- name: Get golangci-lint cache path
|
|
id: golangci-lint-cache-status
|
|
run: |
|
|
echo "::set-output name=dir::$(golangci-lint cache status | head -1 | sed 's/^Dir: //')"
|
|
|
|
- name: Set up golangci-lint cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
key: golangci-lint-${{ runner.os }}-golangci-lint-${{ hashFiles('go.mod') }}
|
|
restore-keys: golangci-lint-${{ runner.os }}-golangci-lint-
|
|
path: ${{ steps.golangci-lint-cache-status.outputs.dir }}
|
|
|
|
- run: go version
|
|
- run: diff -u <(echo -n) <(gofmt -d .)
|
|
- name: Run golangci-lint
|
|
run: golangci-lint run
|