Skip to content

Add workflow for static analysis (go vet, gofmt, staticcheck) #1

Add workflow for static analysis (go vet, gofmt, staticcheck)

Add workflow for static analysis (go vet, gofmt, staticcheck) #1

name: Check
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Download deps
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update && sudo apt-get install -y libpango1.0-dev libx11-dev libxext-dev libxft-dev libxinerama-dev libxcursor-dev libxrender-dev libxfixes-dev libpng-dev libgl1-mesa-dev libglu1-mesa-dev
fi
shell: bash
- name: Install analysis tools
run: |
go install golang.org/x/tools/cmd/goimports@latest
go install honnef.co/go/tools/cmd/staticcheck@v0.4.2
- name: Vet
run: go vet ./...
- name: Goimports
run: test -z "$(goimports -e -d . | tee /dev/stderr)"
- name: Staticcheck
run: staticcheck ./...