Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

on:
push:
branches:
- master
pull_request:

jobs:
build_and_test:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
check-latest: true
go-version-file: "go.mod"

- name: Display Go version
run: go version

- name: Test
run: make test

golangci-lint:
runs-on: ubuntu-latest
env:
GOLANGCI_LINT_VERSION: v1.64.6

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
check-latest: true
go-version-file: "go.mod"

- name: Lint
uses: golangci/golangci-lint-action@v6
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
96 changes: 96 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
issues:
exclude:
- 'Error return value of .(\w+\.Rollback(.*)). is not checked'

linters:
presets:
- bugs
- comment
- format
- performance
- style
- test
- unused

disable:
# disabled, but which we should enable with discussion
- wrapcheck # checks that errors are wrapped; currently not done anywhere

# disabled because we're not compliant, but which we should think about
- exhaustruct # checks that properties in structs are exhaustively defined; may be a good idea
- testpackage # requires tests in test packages like `river_test`

# disabled because they're annoying/bad
- interfacebloat # we do in fact want >10 methods on the Adapter interface or wherever we see fit.
- godox # bans TODO statements; total non-starter at the moment
- err113 # wants all errors to be defined as variables at the package level; quite obnoxious
- mnd # detects "magic numbers", which it defines as any number; annoying
- ireturn # bans returning interfaces; questionable as is, but also buggy as hell; very, very annoying
- lll # restricts maximum line length; annoying
- nlreturn # requires a blank line before returns; annoying
- wsl # a bunch of style/whitespace stuff; annoying

linters-settings:
depguard:
rules:
all:
files: ["$all"]
deny:
- desc: "Use `github.com/google/uuid` package for UUIDs instead."
pkg: "github.com/xtgo/uuid"

forbidigo:
forbid:
- msg: "Use `require` variants instead."
p: '^assert\.'
- msg: "Use `Func` suffix for function variables instead."
p: 'Fn\b'
- msg: "Use built-in `max` function instead."
p: '\bmath\.Max\b'
- msg: "Use built-in `min` function instead."
p: '\bmath\.Min\b'

gci:
sections:
- Standard
- Default
- Prefix(github.com/riverqueue)

gomoddirectives:
replace-local: true

gosec:
excludes:
- G404 # use of non-crypto random; overly broad for our use case

revive:
rules:
- name: unused-parameter
disabled: true

tagliatelle:
case:
rules:
json: snake

testifylint:
enable-all: true
disable:
- go-require

varnamelen:
ignore-names:
- db
- eg
- f
- i
- id
- j
- mu
- r
- sb # common convention for string builder
- t
- tt # common convention for table tests
- tx
- w
- wg
7 changes: 7 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2025 Blake Gentry, Brandur Leach

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.DEFAULT_GOAL := help

# Looks at comments using ## on targets and uses them to produce a help output.
.PHONY: help
help: ALIGN=22
help: ## Print this message
@awk -F '::? .*## ' -- "/^[^':]+::? .*## /"' { printf "'$$(tput bold)'%-$(ALIGN)s'$$(tput sgr0)' %s\n", $$1, $$2 }' $(MAKEFILE_LIST)

.PHONY: lint
lint:: ## Run linter
golangci-lint run --fix

.PHONY: test
test:: ## Run test suite
go test ./...

.PHONY: test/race
test/race:: ## Run test suite with race detector
go test ./... -race

.PHONY: tidy
tidy:: ## Run `go mod tidy`
go mod tidy
Loading
Loading