-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add golangci-lint linter to enforce that the
io/ioutil
package is n…
…ot used anymore (#34) This makes use of the `golangci-lint` [1] linters aggregator, configured with the `depguard`[2] linter to enforce that the deprecated `io/ioutil` [3] package is not used anymore in the code. NOTE: Ideally, we should use all linters enabled by default by `golangci-lint`. But doing so reports a lot of issues, not relevant to the issue here (which is to enforce that 'io/ioutil' is not used anymore). Enabling the default linters and fixing the issues reported can be done in a subsequent issue/PR. [1] https://golangci-lint.run/ [2] https://golangci-lint.run/usage/linters/#depguard [3] https://pkg.go.dev/io/ioutil#pkg-overview Signed-off-by: Armel Soro <asoro@redhat.com>
- Loading branch information
Showing
3 changed files
with
58 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,44 @@ | ||
# Refer to golangci-lint's reference config file for more options and information: | ||
# https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml | ||
|
||
run: | ||
# Timeout for analysis, e.g. 30s, 5m. | ||
# Default: 1m | ||
timeout: 5m | ||
|
||
# Allowed values: readonly|vendor|mod | ||
# By default, it isn't set. | ||
modules-download-mode: readonly | ||
|
||
skip-dirs: | ||
- resources/projects | ||
|
||
linters: | ||
# Disable all linters. | ||
# Default: false | ||
# TODO(rm3l): all default linters are disabled in the context of https://github.com/devfile/api/issues/1257 (to just enforce that io/ioutil is not used anymore), | ||
# but we should think about enabling all the default linters and fix the issues reported. | ||
disable-all: true | ||
enable: | ||
# Go linter that checks if package imports are in a list of acceptable packages | ||
- depguard | ||
|
||
linters-settings: | ||
depguard: | ||
rules: | ||
# Name of a rule. | ||
main: | ||
deny: | ||
- pkg: "io/ioutil" | ||
desc: "Deprecated since Go 1.16. Use the implementations from 'io' or 'os' packages instead." | ||
|
||
issues: | ||
# Maximum issues count per one linter. | ||
# Set to 0 to disable. | ||
# Default: 50 | ||
max-issues-per-linter: 0 | ||
|
||
# Maximum count of issues with the same text. | ||
# Set to 0 to disable. | ||
# Default: 3 | ||
max-same-issues: 0 |
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