feature/add-linting-tools #4

Merged
torjus merged 5 commits from feature/add-linting-tools into master 2026-02-04 00:55:15 +00:00
Owner

Summary

Add linting tools to the development workflow and fix all existing linting issues.

Changes

  • Add govulncheck to devshell - vulnerability scanning for Go dependencies (golangci-lint was already present)
  • Fix staticcheck warning - resolve potential nil pointer dereference in session_test.go by using t.Fatal instead of t.Error
  • Fix ineffassign warnings - address ineffectual assignment to argNum in postgres.go SearchOptions
  • Fix errcheck warnings - add //nolint:errcheck comments to 33 intentionally unchecked error returns:
    • defer X.Close() on read-only resources (files, rows, response bodies, gzip readers)
    • defer tx.Rollback() - standard Go pattern where rollback after commit returns expected error
    • Cleanup operations (DeleteRevision on failure, os.RemoveAll for temp dirs)
    • HTTP response encoding where failures can't be handled
    • Test/benchmark cleanup code
  • Update CLAUDE.md - document requirement to run linting tools before completing features

Linting Results

Tool Before After
golangci-lint 37 issues 0 issues
govulncheck N/A No vulnerabilities
go vet 0 issues 0 issues

New Development Workflow

Before completing work on a feature branch, run:

nix develop -c golangci-lint run ./...
nix develop -c govulncheck ./...
nix develop -c go vet ./...
## Summary Add linting tools to the development workflow and fix all existing linting issues. ### Changes - **Add `govulncheck` to devshell** - vulnerability scanning for Go dependencies (golangci-lint was already present) - **Fix staticcheck warning** - resolve potential nil pointer dereference in `session_test.go` by using `t.Fatal` instead of `t.Error` - **Fix ineffassign warnings** - address ineffectual assignment to `argNum` in `postgres.go` SearchOptions - **Fix errcheck warnings** - add `//nolint:errcheck` comments to 33 intentionally unchecked error returns: - `defer X.Close()` on read-only resources (files, rows, response bodies, gzip readers) - `defer tx.Rollback()` - standard Go pattern where rollback after commit returns expected error - Cleanup operations (DeleteRevision on failure, os.RemoveAll for temp dirs) - HTTP response encoding where failures can't be handled - Test/benchmark cleanup code - **Update CLAUDE.md** - document requirement to run linting tools before completing features ### Linting Results | Tool | Before | After | |------|--------|-------| | golangci-lint | 37 issues | 0 issues | | govulncheck | N/A | No vulnerabilities | | go vet | 0 issues | 0 issues | ### New Development Workflow Before completing work on a feature branch, run: ```bash nix develop -c golangci-lint run ./... nix develop -c govulncheck ./... nix develop -c go vet ./... ```
torjus added 5 commits 2026-02-04 00:54:45 +00:00
Add govulncheck for vulnerability scanning of Go dependencies.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use t.Fatal instead of t.Error when retrieved session is nil to prevent
subsequent nil pointer dereference on retrieved.ID.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The argNum variable tracks parameter positions but the final value is
unused. Added explicit acknowledgment to silence the linter.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add //nolint:errcheck comments to intentionally unchecked error returns:

- defer X.Close() calls: errors from closing read-only resources, rows
  after iteration, files, response bodies, and gzip readers are not
  actionable and don't affect correctness

- defer tx.Rollback(): standard Go pattern where rollback after
  successful commit returns an error, which is expected behavior

- defer stmt.Close(): statements are closed with their transactions

- Cleanup operations: DeleteRevision on failure and os.RemoveAll for
  temp directories are best-effort cleanup

- HTTP response encoding: if JSON encoding fails at response time,
  there's nothing useful we can do

- Test/benchmark code: unchecked errors in test setup/cleanup where
  failures will surface through test assertions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document the requirement to run golangci-lint, govulncheck, and go vet
before completing work on a feature branch.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
torjus merged commit 9efcca217c into master 2026-02-04 00:55:15 +00:00
torjus deleted branch feature/add-linting-tools 2026-02-04 00:55:15 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: torjus/labmcp#4