From e201b66f3de20b8f599b59b89466b68725f8c53a Mon Sep 17 00:00:00 2001 From: Joakim Olsson Date: Fri, 9 Jan 2026 08:01:34 +0100 Subject: [PATCH] chore: migrate module path from gitlab.com to git.unbound.se - Update go.mod module path to git.unbound.se/unboundsoftware/dbsetup - Remove gitlab-ci-linter pre-commit hook (not applicable for Gitea) - Update go-imports local path for new domain - Update CLAUDE.md documentation with new paths - Remove GitLab-specific badges from README.md Co-Authored-By: Claude Opus 4.5 --- .claude/settings.local.json | 15 +++++++++++ .pre-commit-config.yaml | 9 +------ CLAUDE.md | 53 +++++++++++++++++++++++++++++++++++++ README.md | 3 --- go.mod | 2 +- 5 files changed, 70 insertions(+), 12 deletions(-) create mode 100644 .claude/settings.local.json create mode 100644 CLAUDE.md diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 0000000..015e769 --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,15 @@ +{ + "permissions": { + "allow": [ + "Bash(ls:*)", + "Bash(git -C /Users/argoyle/Source/Unbound/dbsetup log --oneline -20)", + "Bash(find:*)", + "WebSearch", + "Bash(git add:*)", + "Bash(pre-commit run:*)", + "Bash(go build:*)", + "Bash(go test:*)", + "Bash(but status)" + ] + } +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 26c203a..c296b35 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,13 +10,6 @@ repos: args: - --allow-multiple-documents - id: check-added-large-files -- repo: https://gitlab.com/devopshq/gitlab-ci-linter - rev: v1.0.6 - hooks: - - id: gitlab-ci-linter - args: - - --project - - unboundsoftware/dbsetup - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook rev: v9.23.0 hooks: @@ -30,7 +23,7 @@ repos: - id: go-imports args: - -local - - gitlab.com/unboundsoftware/shiny/presenter + - git.unbound.se/unboundsoftware/shiny/presenter - repo: https://github.com/lietu/go-pre-commit rev: v1.0.0 hooks: diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..cf5d6f6 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,53 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +**dbsetup** is a Go helper module for database connection pool initialization with OpenTelemetry (OTEL) instrumentation. It wraps database connections with OTEL to automatically add SQL queries to tracing spans. + +- Module path: `git.unbound.se/unboundsoftware/dbsetup` +- Primary dependencies: sqlx, goose (migrations), otelsqlx (OTEL wrapper) + +## Common Commands + +```bash +# Download dependencies +go mod download + +# Run tests with race detection and coverage +CGO_ENABLED=1 go test -race -coverprofile=coverage.txt ./... + +# Generate coverage report +go tool cover -html=coverage.txt -o coverage.html + +# Check for security vulnerabilities +go install golang.org/x/vuln/cmd/govulncheck@latest +govulncheck ./... + +# Run pre-commit hooks (add all files first) +git add -A && pre-commit run --all-files +``` + +## Architecture + +Single-package module with one source file (`database.go`): + +- **DatabaseConfig**: Configuration struct with connection URL, driver name, and pool settings. Uses struct tags compatible with kong CLI parser. +- **Database**: Main handler providing: + - `SetupDB()` - Validates database connection and returns Database instance + - `Connect()` - Creates OTEL-wrapped connection pool via otelsqlx + - `RunMigrations()` - Executes goose migrations from an `fs.FS` filesystem + +## Code Quality + +Pre-commit hooks enforce: +- gofumpt formatting (stricter than gofmt) +- golangci-lint +- go-imports with local path `git.unbound.se/unboundsoftware/` +- Conventional commits format (feat:, fix:, chore:, etc.) +- Gitleaks for secret detection + +## CI/CD + +GitLab CI pipeline runs: dependency download → tests with race detector → vulnerability scanning → Codecov upload. diff --git a/README.md b/README.md index e942d79..12c16d3 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,3 @@ Helper module for setting up database connection pool using an OTEL-wrapper which adds the actual query to a span. - -[![Build Status](https://gitlab.com/unboundsoftware/dbsetup/badges/main/pipeline.svg)](https://gitlab.com/unboundsoftware/dbsetup/commits/main) -[![codecov](https://codecov.io/gl/unboundsoftware/dbsetup/branch/main/graph/badge.svg?token=XHA5XE1UVL)](https://codecov.io/gl/unboundsoftware/dbsetup) diff --git a/go.mod b/go.mod index 1751841..f155436 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module gitlab.com/unboundsoftware/dbsetup +module git.unbound.se/unboundsoftware/dbsetup go 1.24.4