This repository has been archived by the owner on Sep 6, 2024. It is now read-only.
forked from hercules-ci/flake-parts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(programs): add golangci-lint (hercules-ci#134)
- Loading branch information
1 parent
e82f32a
commit affe7fc
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Example generated by ../examples.sh | ||
[formatter.golangci-lint] | ||
command = "golangci-lint" | ||
excludes = [] | ||
includes = ["*.go"] | ||
options = ["run"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ lib, pkgs, config, ... }: | ||
let | ||
cfg = config.programs.golangci-lint; | ||
in | ||
{ | ||
options.programs.golangci-lint = { | ||
enable = lib.mkEnableOption "golangci-lint"; | ||
package = lib.mkPackageOption pkgs "golangci-lint" { }; | ||
goPackage = lib.mkPackageOption pkgs "go" { }; | ||
}; | ||
|
||
config = lib.mkIf cfg.enable { | ||
settings.formatter.golangci-lint = { | ||
command = pkgs.writeShellApplication { | ||
name = "golangci-lint"; | ||
runtimeInputs = [ | ||
cfg.package | ||
cfg.goPackage | ||
]; | ||
text = "${cfg.package}/bin/golangci-lint \"$@\""; | ||
}; | ||
options = [ "run" ]; | ||
includes = [ "*.go" ]; | ||
}; | ||
}; | ||
} |