Skip to content

Commit 2c13cd6

Browse files
committed
chore: modernize toolchain, CI/CD, and documentation
This comprehensive update brings the repository in line with modern Go 1.24 practices and patterns used across other Axiom OSS repositories. ## Toolchain & Language Updates ### Go 1.24 Tool Directive Pattern - Remove tools.go in favor of 'tool' block in go.mod - Add golangci-lint/v2, goreleaser/v2, gotestsum as tools - Update Makefile to use 'go tool' pattern ### Modern Go Language Features (1.17-1.24) - Replace interface{} with 'any' type alias throughout - Use built-in min/max functions instead of custom logic - Use strings.Cut for parsing key=value pairs - Use range over integers syntax (for range n) - Use t.TempDir() in tests for automatic cleanup ## Linting Infrastructure ### golangci-lint v2 Format - Add version: "2" header - Restructure with separate linters and formatters sections - Replace deprecated exportloopref with copyloopvar - Remove deprecated typecheck, gosimple linters ## CI/CD Enhancements ### GitHub Actions Updates - Update all actions to latest versions (v4, v5, v8) - Add concurrency controls to prevent redundant runs - Dynamic tool version detection from go.mod - Update Go matrix to 1.24/1.25 - Replace single go.yml with dedicated pr, push, release workflows - Add ci-pass check job to ensure all required jobs pass ### Workflow Improvements - Test job now depends on successful linting - Added ci-pass job as final check (similar to variance repo) - Push workflow includes build verification with goreleaser snapshot ## Documentation Updates ### README Modernization - Adopt cleaner, more concise format matching axiom-go style - Move badges inline with title - Clear sections: Install, Usage, Features, Configuration, License - Update badge URLs to use modern GitHub Actions paths ## Code Quality Improvements - Remove unused parameters or mark with _ - Replace deprecated io/ioutil with os package functions - Fix redefinition of built-in 'max' function - Remove superfluous else statements - Update deprecated nolint directives - Use t.TempDir() in tests instead of manual temp dir management ## Additional Updates - Add comprehensive .gitignore patterns - Add dependabot.yaml for automated dependency updates - Migrate goreleaser to v2 format
1 parent 20a9e34 commit 2c13cd6

21 files changed

+2387
-1023
lines changed

.github/dependabot.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: gomod
4+
directory: /
5+
schedule:
6+
interval: daily
7+
ignore:
8+
- dependency-name: "*"
9+
update-types:
10+
- version-update:semver-minor
11+
- version-update:semver-major
12+
- package-ecosystem: github-actions
13+
directory: /
14+
schedule:
15+
interval: daily
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Dependent PR
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- edited
8+
- closed
9+
- reopened
10+
pull_request_target:
11+
types:
12+
- opened
13+
- edited
14+
- closed
15+
- reopened
16+
- synchronize
17+
merge_group:
18+
types:
19+
- checks_requested
20+
schedule:
21+
- cron: "0 * * * *"
22+
23+
jobs:
24+
check:
25+
name: Check
26+
runs-on: ubuntu-latest
27+
if: github.repository_owner == 'axiomhq'
28+
steps:
29+
- uses: z0al/dependent-issues@v1
30+
if: github.actor != 'dependabot[bot]'
31+
env:
32+
GITHUB_TOKEN: ${{ github.token }}
33+
GITHUB_READ_TOKEN: ${{ secrets.AXIOM_AUTOMATION_TOKEN }}
34+
with:
35+
label: dependent
36+
keywords: depends on, blocked by, needs, requires
37+
- uses: LouisBrunner/checks-action@v2.0.0
38+
if: github.actor == 'dependabot[bot]'
39+
with:
40+
token: ${{ github.token }}
41+
name: Dependent Issues
42+
conclusion: success
43+
output: |
44+
{"summary":"Not checking for dependent issues or PRs on Dependabot PRs."}

.github/workflows/go.yml

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

.github/workflows/pr.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: PR
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
# Make sure the workflow is only ever run for the latest changes in the PR.
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
lint:
15+
name: Lint
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
go:
20+
- "1.24"
21+
- "1.25"
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-go@v5
25+
with:
26+
go-version: ${{ matrix.go }}
27+
cache: false
28+
- run: echo "GOLANGCI_LINT_VERSION=$(go list -m -f '{{.Version}}' github.com/golangci/golangci-lint/v2)" >> $GITHUB_ENV
29+
- uses: golangci/golangci-lint-action@v8
30+
with:
31+
version: ${{ env.GOLANGCI_LINT_VERSION }}
32+
only-new-issues: true
33+
34+
test:
35+
name: Test
36+
needs: lint
37+
runs-on: ubuntu-latest
38+
strategy:
39+
matrix:
40+
go:
41+
- "1.24"
42+
- "1.25"
43+
steps:
44+
- uses: actions/checkout@v4
45+
- uses: actions/setup-go@v5
46+
with:
47+
go-version: ${{ matrix.go }}
48+
cache: false
49+
- name: Test
50+
run: make test
51+
52+
ci-pass:
53+
name: CI Pass
54+
needs:
55+
- lint
56+
- test
57+
runs-on: ubuntu-latest
58+
if: always()
59+
steps:
60+
- if: |
61+
needs.lint.result != 'success' ||
62+
needs.test.result != 'success'
63+
run: exit 1

.github/workflows/push.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Push
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
# Make sure the workflow is only ever run for the latest changes on main.
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
lint:
15+
name: Lint
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-go@v5
20+
with:
21+
go-version-file: go.mod
22+
cache: false
23+
- run: echo "GOLANGCI_LINT_VERSION=$(go list -m -f '{{.Version}}' github.com/golangci/golangci-lint/v2)" >> $GITHUB_ENV
24+
- uses: golangci/golangci-lint-action@v8
25+
with:
26+
version: ${{ env.GOLANGCI_LINT_VERSION }}
27+
28+
test:
29+
name: Test
30+
needs: lint
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
- uses: actions/setup-go@v5
35+
with:
36+
go-version-file: go.mod
37+
cache: true
38+
- name: Test
39+
run: make test
40+
41+
build:
42+
name: Build
43+
needs: test
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
with:
48+
fetch-depth: 0
49+
- uses: actions/setup-go@v5
50+
with:
51+
go-version-file: go.mod
52+
- run: echo "GORELEASER_VERSION=$(go list -m -f '{{.Version}}' github.com/goreleaser/goreleaser/v2)" >> $GITHUB_ENV
53+
- uses: goreleaser/goreleaser-action@v6
54+
with:
55+
version: ${{ env.GORELEASER_VERSION }}
56+
args: --snapshot
57+
58+
ci-pass:
59+
name: CI Pass
60+
needs:
61+
- lint
62+
- test
63+
- build
64+
runs-on: ubuntu-latest
65+
if: always()
66+
steps:
67+
- if: |
68+
needs.lint.result != 'success' ||
69+
needs.test.result != 'success' ||
70+
needs.build.result != 'success'
71+
run: exit 1

.github/workflows/release.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- uses: actions/setup-go@v5
17+
with:
18+
go-version-file: go.mod
19+
- run: echo "GORELEASER_VERSION=$(go list -m -f '{{.Version}}' github.com/goreleaser/goreleaser/v2)" >> $GITHUB_ENV
20+
- uses: goreleaser/goreleaser-action@v6
21+
with:
22+
version: ${{ env.GORELEASER_VERSION }}
23+
args: release
24+
env:
25+
GITHUB_TOKEN: ${{ github.token }}

.gitignore

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,38 @@
1010

1111
# Output of the go coverage tool, specifically when used with LiteIDE
1212
*.out
13+
coverage.out
14+
coverage.txt
15+
coverage.html
1316

1417
# Build artifacts
15-
dist
18+
dist/
19+
bin/
1620

1721
# Go mod timestamp for Makefile
1822
/dep.stamp
1923

20-
# Local $GOBIN directory for tools
21-
/bin/
24+
# Dependency directories
25+
vendor/
26+
27+
# IDE files
28+
.idea/
29+
*.swp
30+
*.swo
31+
*~
32+
.vscode/
33+
*.iml
34+
35+
# OS files
36+
.DS_Store
37+
Thumbs.db
38+
39+
# Environment files
40+
.env
41+
.env.local
42+
43+
# Temporary files
44+
*.tmp
45+
*.bak
46+
*.backup
47+
*.log

0 commit comments

Comments
 (0)