Skip to content

New formatter: Add golangci-lint support #412

@Dauliac

Description

@Dauliac

treefmt-nix currently doesn't support golangci-lint, a popular and comprehensive Go linter. Go developers have to use separate tools or less comprehensive linters.

Proposed Solution

Add programs/golangci-lint.nix with comprehensive configuration options, following patterns from typos.nix and prettier.nix:

  • enableLinters/disableLinters: Control which linters to run
  • configFile: Path to custom config file
  • timeout: Set analysis timeout
  • concurrency: Configure CPU usage
  • buildTags: Specify build tags
  • tests: Control test file analysis
  • fastOnly: Run only fast linters

Implementation

I can implement this new formatter with:

  • Full golangci-lint CLI option support
  • Follows established treefmt-nix patterns
  • Comprehensive configuration options
  • Auto-fixing capabilities (--fix flag)

This would allow users to configure golangci-lint declaratively:

programs.golangci-lint = {
  enable = true;
  enableLinters = [ "govet" "errcheck" "staticcheck" ];
  timeout = "5m";
  tests = false;
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions