Autoreview your Go PRs using reviewdog and golangci-lint!
Problem?
Detect simple problems problem with Go code within a PR.
Solution?
golangci-lint
+ reviewdog
+ Github Actions
golangci-lint
- aggregates many open source linters into one linting program.
reviewdog
- a glue to connect linter output with Github Actions via:
- checks
- PR comments
- PR annotations
Github Actions - run those two above for each PR
How?
Like this:
name: Reviewdog
on:
pull_request:
branches:
- main
paths:
- **/*.go
jobs:
reviewdog:
name: reviewdog
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Lint
uses: reviewdog/action-golangci-lint@v2
with:
workdir: app/
golangci_lint_flags: --timeout=10m
.github/workflows/reviewdog.yaml
linters:
enable:
# Errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases.
- errcheck
# Linter for Go source code that specializes in simplifying code.
- gosimple
app/.golangci.yml
How it looks like?



Reference
golangci-lint
repo - https://github.com/golangci/golangci-lintgolangci-lint
available linters - https://golangci-lint.run/usage/linters/reviewdog
repo - https://github.com/reviewdog/reviewdogreviewdog
golangci-lint
action - https://github.com/reviewdog/action-golangci-lint