Skip to content

Commit f2e638b

Browse files
committed
chore: various scaffolding fixes
- bump Go to 1.26.5 and refresh dependencies - consolidate workflows and add golangci-lint config - fix Makefile and goreleaser project paths - use errors.New for non-constant messages - update LICENSE to MIT
1 parent 7f53c02 commit f2e638b

14 files changed

Lines changed: 564 additions & 1184 deletions

File tree

.github/workflows/ci.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: ci
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- "README.md"
7+
push:
8+
branches:
9+
- main
10+
paths-ignore:
11+
- "README.md"
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
lint:
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 5
20+
steps:
21+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
22+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
23+
with:
24+
go-version-file: "go.mod"
25+
cache: false
26+
27+
- name: Ensure go modules are tidy
28+
run: |
29+
go mod tidy
30+
if [[ -n $(git status -s) ]] ; then
31+
echo
32+
echo -e "\e[31mRunning 'go mod tidy' changes the current setting"
33+
echo -e "\e[31mEnsure to include updated go.mod and go.sum in this PR."
34+
echo -e "\e[31mThis is usually done by running 'go mod tidy'\e[0m"
35+
git status -s
36+
git diff --color
37+
exit 1
38+
fi
39+
40+
- name: Ensure generated files are up to date
41+
run: |
42+
go generate ./...
43+
if [[ -n $(git status -s) ]] ; then
44+
echo
45+
echo -e "\e[31mRunning 'go generate ./...' changes the current setting"
46+
echo -e "\e[31mEnsure to include the regenerated files in this PR."
47+
echo -e "\e[31mThis is usually done by running 'go generate ./...'\e[0m"
48+
git status -s
49+
git diff --color
50+
exit 1
51+
fi
52+
53+
- name: Run linters
54+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
55+
with:
56+
version: latest
57+
58+
build:
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
os: [ubuntu-latest, macos-latest, windows-latest]
63+
runs-on: ${{ matrix.os }}
64+
timeout-minutes: 15
65+
steps:
66+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
67+
68+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
69+
with:
70+
go-version-file: "go.mod"
71+
cache: false
72+
73+
- run: go mod download
74+
75+
- run: make build
76+
77+
test:
78+
strategy:
79+
fail-fast: false
80+
matrix:
81+
os: [ubuntu-latest, macos-latest, windows-latest]
82+
runs-on: ${{ matrix.os }}
83+
timeout-minutes: 15
84+
steps:
85+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
86+
87+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
88+
with:
89+
go-version-file: "go.mod"
90+
cache: false
91+
92+
- run: go mod download
93+
94+
- run: make test

.github/workflows/codeql.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/gosec.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
# run only against tags
6+
tags:
7+
- "*"
8+
9+
permissions:
10+
contents: write
11+
# packages: write
12+
# issues: write
13+
14+
jobs:
15+
goreleaser:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- run: echo "PWD=`pwd`" >> $GITHUB_ENV
19+
- uses: actions/checkout@v3
20+
with:
21+
fetch-depth: 0
22+
- run: git fetch --force --tags
23+
- uses: actions/setup-go@v3
24+
with:
25+
go-version: ">=1.19.3"
26+
- uses: goreleaser/goreleaser-action@v2
27+
with:
28+
distribution: goreleaser
29+
version: latest
30+
args: release --rm-dist
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/testing.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.gitignore

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
# If you prefer the allow list template instead of the deny list, see community template:
2+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3+
#
14
# Binaries for programs and plugins
25
*.exe
36
*.exe~
47
*.dll
58
*.so
69
*.dylib
10+
*.DS_Store
11+
*.vscode
712

813
# Test binary, built with `go test -c`
914
*.test
@@ -13,7 +18,10 @@
1318

1419
# Dependency directories (remove the comment below to include it)
1520
# vendor/
16-
build/
17-
bin/
1821

22+
# Go workspace file
23+
go.work
24+
go.work.sum
25+
26+
bin/
1927
dist/

.golangci.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
version: "2"
2+
linters:
3+
enable:
4+
- copyloopvar
5+
- durationcheck
6+
- errcheck
7+
- forcetypeassert
8+
- ineffassign
9+
- godot
10+
- gosec
11+
- govet
12+
- makezero
13+
- misspell
14+
- nilerr
15+
- predeclared
16+
- sloglint
17+
- staticcheck
18+
- unconvert
19+
- unparam
20+
- unused
21+
exclusions:
22+
generated: lax
23+
presets:
24+
- comments
25+
- common-false-positives
26+
- legacy
27+
- std-error-handling
28+
paths:
29+
- third_party$
30+
- builtin$
31+
- examples$
32+
formatters:
33+
enable:
34+
- gofmt
35+
exclusions:
36+
generated: lax
37+
paths:
38+
- third_party$
39+
- builtin$
40+
- examples$

0 commit comments

Comments
 (0)