A community based topic aggregation platform built on atproto

feat(lint): add code formatting enforcement to linter

Configuration changes:
- Add gofmt, gofumpt, and goimports linters to .golangci.yml
- Configure gofmt.simplify to simplify code where possible
- Configure gofumpt with extra-rules for stricter formatting
- Configure errcheck.check-blank=false to allow blank assignments in defer closures (idiomatic Go)
- Disable govet shadow checking to reduce noise in tests (common practice)
- Exclude local_dev_data and vendor directories from linting

Makefile enhancements:
- Add 'fmt' target: format all Go code with gofmt
- Add 'fmt-check' target: verify code is formatted (CI-friendly, fails if not formatted)
- Update 'lint' target: now runs fmt-check automatically before linting
- Update 'lint-fix' target: runs golangci-lint --fix AND gofmt
- Update linter to run on specific paths (./cmd/... ./internal/... ./tests/...) to avoid permission issues

Formatting is now enforced as part of the standard lint workflow.
Running 'make lint' will catch both code issues and formatting problems.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Changed files
+34 -4
+14 -1
.golangci.yml
···
linters:
enable:
- gofmt # Enforce standard Go formatting
+
- gofumpt # Stricter gofmt (extra formatting rules)
+
- goimports # Check import organization
- govet # Examine Go source code and report suspicious constructs
- errcheck # Check for unchecked errors
- staticcheck # Advanced static analysis
···
- typecheck # Standard Go type checker
linters-settings:
+
gofmt:
+
simplify: true # Simplify code where possible
+
+
gofumpt:
+
extra-rules: true # Enable extra formatting rules
+
errcheck:
-
check-blank: true # Check for blank error assignments (x, _ = f())
+
check-blank: false # Don't check blank assignments (allows _ = in defer closures)
govet:
enable-all: true
+
disable:
+
- shadow # Disable shadow checking (common pattern in tests)
staticcheck:
checks: ["all"]
···
exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0
+
exclude-dirs:
+
- local_dev_data
+
- vendor
+20 -3
Makefile
···
##@ Code Quality
-
lint: ## Run golangci-lint on the codebase
+
fmt: ## Format all Go code with gofmt
+
@echo "$(GREEN)Formatting Go code...$(RESET)"
+
@gofmt -w ./cmd ./internal ./tests
+
@echo "$(GREEN)✓ Formatting complete$(RESET)"
+
+
fmt-check: ## Check if Go code is properly formatted
+
@echo "$(GREEN)Checking code formatting...$(RESET)"
+
@unformatted=$$(gofmt -l ./cmd ./internal ./tests); \
+
if [ -n "$$unformatted" ]; then \
+
echo "$(RED)✗ The following files are not formatted:$(RESET)"; \
+
echo "$$unformatted"; \
+
echo "$(YELLOW)Run 'make fmt' to fix$(RESET)"; \
+
exit 1; \
+
fi
+
@echo "$(GREEN)✓ All files are properly formatted$(RESET)"
+
+
lint: fmt-check ## Run golangci-lint on the codebase (includes format check)
@echo "$(GREEN)Running linter...$(RESET)"
-
@golangci-lint run
+
@golangci-lint run ./cmd/... ./internal/... ./tests/...
@echo "$(GREEN)✓ Linting complete$(RESET)"
lint-fix: ## Run golangci-lint and auto-fix issues
@echo "$(GREEN)Running linter with auto-fix...$(RESET)"
-
@golangci-lint run --fix
+
@golangci-lint run --fix ./cmd/... ./internal/... ./tests/...
+
@gofmt -w ./cmd ./internal ./tests
@echo "$(GREEN)✓ Linting complete$(RESET)"
##@ Build & Run