CI: use staticcheck-action #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [push, pull_request] | |
name: Go | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go-version: [1.17.x, 1.20.x, 1.21.x] | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Install libpcap | |
run: sudo apt-get install -y --no-install-recommends libpcap* | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Ensure gofmt formatting | |
if: matrix.platform == 'ubuntu-latest' && startsWith(matrix.go-version, '1.21') | |
run: | | |
[ "$(gofmt -l $(find . -name '*.go') 2>&1)" = "" ] | |
- name: Download Go dependencies | |
env: | |
GOPROXY: "https://proxy.golang.org" | |
run: go mod download | |
- name: Test with -race | |
run: go test -race -count=1 ./... | |
- name: staticcheck.io | |
if: startsWith(matrix.go-version, '1.21') | |
uses: dominikh/[email protected] | |
with: | |
version: "2023.1.6" | |
install-go: false | |
cache-key: ${{ matrix.go }} |