Skip to content

Adds pre-commit hook #120

Adds pre-commit hook

Adds pre-commit hook #120

Workflow file for this run

name: "Verify"
on: [push, workflow_call]
jobs:
verify:
name: Verify
runs-on: ubuntu-latest
steps:
# - uses: ./.github/workflows/setup_code.yml
- name: Install required packages
run: sudo apt-get update && sudo apt-get install -y libgl1-mesa-dev xorg-dev
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
- name: "Install staticcheck"
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: "Install goimports"
run: go install golang.org/x/tools/cmd/goimports@latest
- name: "Run go vet"
run: go vet ./...
- name: "Run goimports"
run: test -z $(find . -name '*.go' -type f | xargs goimports -e -d | tee /dev/stderr)
- name: "Run staticcheck"
run: staticcheck ./...
- name: "Unit Tests"
run: go test -v -race -cover ./...
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: "1.21.x"
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: latest
# Optional: working directory, useful for monorepos
# working-directory: somedir
# Optional: golangci-lint command line arguments.
#
# Note: by default the `.golangci.yml` file should be at the root of the repository.
# The location of the configuration file can be changed by using `--config=`
# args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0
args: --timeout=30m
# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
# Optional:The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
# install-mode: "goinstall"