Skip to content

Conversation

@tobias-kuendig
Copy link

It is currently not possible to define any of the many golangci-lint flags: https://golangci-lint.run/docs/configuration/cli/#run

This PR adds the option to do so.

@sandydoo
Copy link
Member

Does hooks.golangci-lint.args = [ ... ]; work for this hook?

@sandydoo sandydoo added the enhancement New feature or request label Oct 16, 2025
@tobias-kuendig
Copy link
Author

tobias-kuendig commented Oct 27, 2025

I don't see where the args would be added to the command:

${hooks.golangci-lint.package}/bin/golangci-lint run ./"$dir"

Using this config:

    golangci-lint = {
      enable = true;
      args = [ "--fix" ];
    };

The following output is generated:

 {
          "always_run": false,
          "args": [
            "--fix"
          ],
          "entry": "/nix/store/y1xfcgx6821rwynpfjpp4a8s6if3mwma-precommit-golangci-lint",
          "exclude": "^$",
          "exclude_types": [],
          "fail_fast": false,
          "files": "\\.go$",
          "id": "golangci-lint",
          "language": "system",
          "name": "golangci-lint",
          "pass_filenames": true,
          "require_serial": true,
          "stages": [
            "pre-commit"
          ],
          "types": [
            "file"
          ],
          "types_or": [],
          "verbose": false
        },

But the --fix argument is not used by the golangci-lint command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants