README
¶
WG Vet
Is a tool that does what go vet
does, plus a few custom checks. It is useful for specific needs in a go dev shop. It's easy to extend.
Getting Started
Install
$ go install github.com/sean9999/wgvet@latest
Run
$ cd /my/repo
$ wgvet . # or
$ wgvet ./...
Git hook
Prevent git commits from succeeding by placing this in ./.git/hooks/pre-commit
:
#!/bin/sh
wgvet ./...
Github CI
You can have this run on every push with .github/workflows/vet.yml
:
name: wgvet
run-name: vetting with wgvet
on: [push, workflow_dispatch]
jobs:
vet:
runs-on: ubuntu-latest
steps:
- name: Setup Go 1.23.x
uses: actions/setup-go@v5
with:
go-version: '1.23.x'
- name: checkout repo
uses: actions/checkout@v4
- name: insatll wgvet
run: go install github.com/sean9999/wgvet@latest
- name: vet
run: wgvet ./...
How to extend
$ git clone github.com/sean9999/wgvet
Edit or add exported symbols in ./pkg/*.go
Import those in ./main.go
$ make install
Documentation
¶
Overview ¶
wgvet does what `go vet` does (more or less), plus some additional checks:
1. Cyclomatic complexity
2. Usage of encoding/json from stdlib. Some shops prefer the performance trade-off that certain drop-in replacements offer.
3. Usage of errors from stdlib. Some shops will want to ensure that you're using errors with special properties like stack traces.
wgvet can be easily extended. See package documention: pkg