nilcheck

command module
v0.0.0-...-40e909f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2025 License: MIT Imports: 18 Imported by: 0

README

nilcheck

A static analysis tool for Go that detects potential nil pointer dereferences.

Features

  • Identifies pointer dereferences without nil checks
  • Detects unsafe access of nil struct pointers
  • Finds potential issues with slices containing nil pointers
  • Analyzes method calls on nil receivers
  • Caches results for better performance

What's next

  • golangci-lint support

Installation

go install github.com/antiartificial/nilcheck@latest

Usage

nilcheck [flags] [packages]
Flags
  • -pkgs: Comma-separated list of packages to analyze
  • -funcs: Comma-separated list of functions to analyze
  • -cache: Path to cache file (default: .nilcheck_cache.json)
Examples
# Analyze a specific package
nilcheck -pkgs=main ./...

# Analyze specific functions
nilcheck -funcs=main.main,GetUsers ./...

# Custom cache location
nilcheck -cache=.custom_cache.json ./...

Development

# Build
go build

# Run tests
go test -v ./...

# Clean cache
rm .nilcheck_cache.json

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL