Skip to content

Commit e534744

Browse files
authored
Import bulk of code from River UI project (#1)
Here, import the framework code from the River UI project at [1]. I've added some READMEs, configuration files, etc., but otherwise very little has changed. There are a couple small things like adding `printf` variants for errors (which we'll need for Go 1.24 because it doesn't let you pass only a message to a printf-like function, and removing errors for specific types like jobs/queues/workflows (those will like in River UI instead). [1] https://github.com/riverqueue/riverui/tree/master/internal
1 parent c9a787b commit e534744

16 files changed

Lines changed: 1462 additions & 0 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
build_and_test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Go
18+
uses: actions/setup-go@v5
19+
with:
20+
check-latest: true
21+
go-version-file: "go.mod"
22+
23+
- name: Display Go version
24+
run: go version
25+
26+
- name: Test
27+
run: make test
28+
29+
golangci-lint:
30+
runs-on: ubuntu-latest
31+
env:
32+
GOLANGCI_LINT_VERSION: v1.64.6
33+
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
38+
- name: Setup Go
39+
uses: actions/setup-go@v5
40+
with:
41+
check-latest: true
42+
go-version-file: "go.mod"
43+
44+
- name: Lint
45+
uses: golangci/golangci-lint-action@v6
46+
with:
47+
version: ${{ env.GOLANGCI_LINT_VERSION }}

.golangci.yaml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
issues:
2+
exclude:
3+
- 'Error return value of .(\w+\.Rollback(.*)). is not checked'
4+
5+
linters:
6+
presets:
7+
- bugs
8+
- comment
9+
- format
10+
- performance
11+
- style
12+
- test
13+
- unused
14+
15+
disable:
16+
# disabled, but which we should enable with discussion
17+
- wrapcheck # checks that errors are wrapped; currently not done anywhere
18+
19+
# disabled because we're not compliant, but which we should think about
20+
- exhaustruct # checks that properties in structs are exhaustively defined; may be a good idea
21+
- testpackage # requires tests in test packages like `river_test`
22+
23+
# disabled because they're annoying/bad
24+
- interfacebloat # we do in fact want >10 methods on the Adapter interface or wherever we see fit.
25+
- godox # bans TODO statements; total non-starter at the moment
26+
- err113 # wants all errors to be defined as variables at the package level; quite obnoxious
27+
- mnd # detects "magic numbers", which it defines as any number; annoying
28+
- ireturn # bans returning interfaces; questionable as is, but also buggy as hell; very, very annoying
29+
- lll # restricts maximum line length; annoying
30+
- nlreturn # requires a blank line before returns; annoying
31+
- wsl # a bunch of style/whitespace stuff; annoying
32+
33+
linters-settings:
34+
depguard:
35+
rules:
36+
all:
37+
files: ["$all"]
38+
deny:
39+
- desc: "Use `github.com/google/uuid` package for UUIDs instead."
40+
pkg: "github.com/xtgo/uuid"
41+
42+
forbidigo:
43+
forbid:
44+
- msg: "Use `require` variants instead."
45+
p: '^assert\.'
46+
- msg: "Use `Func` suffix for function variables instead."
47+
p: 'Fn\b'
48+
- msg: "Use built-in `max` function instead."
49+
p: '\bmath\.Max\b'
50+
- msg: "Use built-in `min` function instead."
51+
p: '\bmath\.Min\b'
52+
53+
gci:
54+
sections:
55+
- Standard
56+
- Default
57+
- Prefix(github.com/riverqueue)
58+
59+
gomoddirectives:
60+
replace-local: true
61+
62+
gosec:
63+
excludes:
64+
- G404 # use of non-crypto random; overly broad for our use case
65+
66+
revive:
67+
rules:
68+
- name: unused-parameter
69+
disabled: true
70+
71+
tagliatelle:
72+
case:
73+
rules:
74+
json: snake
75+
76+
testifylint:
77+
enable-all: true
78+
disable:
79+
- go-require
80+
81+
varnamelen:
82+
ignore-names:
83+
- db
84+
- eg
85+
- f
86+
- i
87+
- id
88+
- j
89+
- mu
90+
- r
91+
- sb # common convention for string builder
92+
- t
93+
- tt # common convention for table tests
94+
- tx
95+
- w
96+
- wg

LICENSE.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2025 Blake Gentry, Brandur Leach
2+
3+
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:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
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.

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.DEFAULT_GOAL := help
2+
3+
# Looks at comments using ## on targets and uses them to produce a help output.
4+
.PHONY: help
5+
help: ALIGN=22
6+
help: ## Print this message
7+
@awk -F '::? .*## ' -- "/^[^':]+::? .*## /"' { printf "'$$(tput bold)'%-$(ALIGN)s'$$(tput sgr0)' %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
8+
9+
.PHONY: lint
10+
lint:: ## Run linter
11+
golangci-lint run --fix
12+
13+
.PHONY: test
14+
test:: ## Run test suite
15+
go test ./...
16+
17+
.PHONY: test/race
18+
test/race:: ## Run test suite with race detector
19+
go test ./... -race
20+
21+
.PHONY: tidy
22+
tidy:: ## Run `go mod tidy`
23+
go mod tidy

0 commit comments

Comments
 (0)