@@ -54,6 +54,12 @@ You can copy/paste the following snippet into your `.pre-commit-config.yaml` fil
5454 - id : go-vet-repo-mod
5555 - id : go-vet-repo-pkg
5656 #
57+ # Revive
58+ #
59+ - id : go-revive
60+ - id : go-revive-mod
61+ - id : go-revive-repo-mod
62+ #
5763 # GoSec
5864 #
5965 - id : go-sec-mod
@@ -137,6 +143,7 @@ For file and repo-based hooks, this isn't an issue, but for module and package-b
137143 args: [ arg1, arg2, ..., '--'] # Pass options ('--' is optional)
138144 always_run: true # Run even if no matching files staged
139145 alias: hook-alias # Create an alias
146+ verbose: true # Display output, even if no errors
140147```
141148
142149#### Passing Options To Hooks
@@ -160,6 +167,11 @@ When configured to `"always_run"`, a hook is executed as if EVERY matching file
160167#### Aliases
161168Consider adding aliases to longer-named hooks for easier CLI usage.
162169
170+ #### Verbose Hook Output
171+ When the `"verbose"` flag is enabled, all output generated by the hook will be displayed, even if there were no errors.
172+
173+ This can be useful, for example, for hooks that display warnings, but don't generate error codes for them.
174+
163175--------
164176## Hooks
165177
@@ -175,6 +187,7 @@ Consider adding aliases to longer-named hooks for easier CLI usage.
175187 - Style Checkers
176188 - [go-lint](#go-lint)
177189 - [go-critic](#go-critic)
190+ - [go-revive](#go-revive)
178191 - GolangCI-Lint
179192 - [golangci-lint](#golangci-lint)
180193
@@ -361,6 +374,37 @@ go get -u golang.org/x/lint/golint
361374 - https://golang.org/doc/effective_go.html
362375 - https://golang.org/wiki/CodeReviewComments
363376
377+ -------------
378+ ### go-revive
379+ ~6x faster, stricter, configurable, extensible, and beautiful drop-in replacement for golint.
380+
381+ | Hook ID | Description
382+ |-----------|------------
383+ | `go-revive` | Run `'revive [$ARGS] $FILE'` for each staged .go file
384+ | `go-revive-mod` | Run `'cd $(mod_root $FILE); revive [$ARGS] ./...'` for each staged .go file
385+ | `go-revive-repo-mod` | Run `'cd $(mod_root); revive [$ARGS] ./...'` for each module in the repo
386+
387+ ##### Install
388+ ```
389+ go get -u github.com/mgechev/revive
390+ ```
391+
392+ ##### Useful Args
393+ ```
394+ -config [ PATH] : Path to config file (TOML)
395+ -exclude [ PATTERN] : Pattern for files/directories/packages to be excluded from linting
396+ -formatter [ NAME] : formatter to be used for the output
397+ ```
398+
399+ ##### Displaying Warnings
400+ By default, `revive` doesn't generate errors on warnings, so warning messages may not be displayed if there are no accompanying error messages.
401+
402+ You can use the `"verbose: true"` hook configuration to always show hook output.
403+
404+ ##### Help
405+ - https://github.com/mgechev/revive#usage
406+ - `revive -h`
407+
364408-------------
365409### go-critic
366410The most opinionated Go source code linter for code audit.
0 commit comments