Skip to content

Add useany linter: Detect interface{} and suggest replacing with any

Choose a tag to compare

@iBakuman iBakuman released this 01 Jul 03:55
· 6 commits to main since this release

πŸš€ New Features

New Linter: useany

Added a new golangci-lint plugin that detects interface{} usage and suggests replacing it with any (Go 1.18+).

Key Features:

  • πŸ” Detects interface{} in all contexts (variables, functions, structs, etc.)
  • πŸ› οΈ Full auto-fix support with golangci-lint --fix
  • 🎯 Only targets empty interfaces, won't flag interfaces with methods

Example:

// Before
var data interface{}

// After (with --fix)  
var data any

Installation:

  1. Add to .custom-gcl.yml:
plugins:
  - module: 'github.com/qor5/linter'
    import: 'github.com/qor5/linter/useany'
  1. Enable in .golangci.yml:
linters:
  enable:
    - useany

πŸ› Bug Fixes

  • Fixed CI test dependencies for errhandle and mustreceive packages