Skip to content

Conversation

@james00012
Copy link
Contributor

@james00012 james00012 commented Aug 17, 2025

Summary

Add golangci-lint to catch nil pointer dereferences at build time. Configured to check only new/modified code for gradual adoption.

Motivation

Recent PRs show multiple nil pointer fixes (#904, #903). This adds automated checks to prevent these issues.

Changes

  • .golangci.yml: Configure linters focused on nil safety (staticcheck, errcheck, nilnil, nilerr)
    • Fixed duplicate 'new' key configuration issue
  • CircleCI: Add lint job that runs before tests
  • Pre-commit: Add golangci-lint hook for local development

Test Plan

  • Verify linting runs only on new code (--new-from-rev=origin/master)
  • Fix configuration issues preventing golangci-lint from running
  • Confirm CircleCI lint job passes
  • Tests still pass after linting

@james00012 james00012 requested a review from denis256 as a code owner August 17, 2025 13:50
@james00012 james00012 force-pushed the feat/add-static-analysis branch 4 times, most recently from 0052d25 to d3cd760 Compare August 17, 2025 14:00
Add golangci-lint for static analysis to prevent nil pointer exceptions and other common Go bugs.

Changes:
- Configure golangci-lint with focus on nil safety (errcheck, nilnil, nilerr, staticcheck)
- Add lint job to CircleCI pipeline that runs before tests
- Create Makefile for local development workflow
- Add GitHub Actions workflow as alternative CI
- Update pre-commit hooks to include linting
- Document static analysis setup and best practices

This addresses recent nil pointer issues by catching them at build time before they reach production.
@james00012 james00012 force-pushed the feat/add-static-analysis branch from d3cd760 to bb3b92d Compare August 17, 2025 14:01
Remove duplicate 'new' key at line 93 that was conflicting with the
existing 'new: true' setting at line 65. This fixes the YAML parsing
error that was preventing golangci-lint from running.
@james00012 james00012 merged commit d0b724b into master Aug 21, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants