chore(linters): Bump golangci-lint to v1.57.2 (#15080)
This commit is contained in:
parent
0750545c4e
commit
0f87501d0a
|
|
@ -101,7 +101,7 @@ jobs:
|
|||
- run: 'make check-deps'
|
||||
- run:
|
||||
name: "Install golangci-lint"
|
||||
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.1
|
||||
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2
|
||||
- run:
|
||||
name: "golangci-lint/Linux"
|
||||
command: GOGC=80 GOMEMLIMIT=6656MiB /go/bin/golangci-lint run --verbose
|
||||
|
|
@ -112,7 +112,7 @@ jobs:
|
|||
- check-changed-files-or-halt
|
||||
- run:
|
||||
name: "Install golangci-lint"
|
||||
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.1
|
||||
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2
|
||||
- run:
|
||||
name: "golangci-lint/macOS"
|
||||
command: GOGC=80 GOMEMLIMIT=6656MiB GOOS=darwin /go/bin/golangci-lint run --verbose --timeout=30m
|
||||
|
|
@ -124,7 +124,7 @@ jobs:
|
|||
- check-changed-files-or-halt
|
||||
- run:
|
||||
name: "Install golangci-lint"
|
||||
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.1
|
||||
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2
|
||||
- run:
|
||||
name: "golangci-lint/Windows"
|
||||
command: GOGC=80 GOMEMLIMIT=6656MiB GOOS=windows /go/bin/golangci-lint run --verbose --timeout=30m
|
||||
|
|
|
|||
124
.golangci.yml
124
.golangci.yml
|
|
@ -72,10 +72,12 @@ linters-settings:
|
|||
- "(*hash/maphash.Hash).WriteByte"
|
||||
- "(*hash/maphash.Hash).WriteString"
|
||||
gocritic:
|
||||
# Which checks should be enabled; can't be combined with 'disabled-checks'.
|
||||
# See https://go-critic.github.io/overview#checks-overview.
|
||||
# To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run`.
|
||||
# By default, list of stable checks is used.
|
||||
# Disable all checks.
|
||||
# Default: false
|
||||
disable-all: true
|
||||
# Which checks should be enabled in addition to default checks; can't be combined with 'disabled-checks'.
|
||||
# By default, list of stable checks is used (https://go-critic.github.io/overview#checks-overview).
|
||||
# To see which checks are enabled run `GL_DEBUG=gocritic golangci-lint run --enable=gocritic`.
|
||||
enabled-checks:
|
||||
# diagnostic
|
||||
- argOrder
|
||||
|
|
@ -188,6 +190,8 @@ linters-settings:
|
|||
settings:
|
||||
## Check the logging function like it would be a printf
|
||||
printf:
|
||||
# Comma-separated list of print function names to check (in addition to default, see `go tool vet help printf`).
|
||||
# Default: []
|
||||
funcs:
|
||||
- (github.com/influxdata/telegraf.Logger).Debugf
|
||||
- (github.com/influxdata/telegraf.Logger).Infof
|
||||
|
|
@ -205,6 +209,10 @@ linters-settings:
|
|||
# Tab width in spaces.
|
||||
# Default: 1
|
||||
tab-width: 4
|
||||
nakedret:
|
||||
# Make an issue if func has more lines of code than this setting, and it has naked returns.
|
||||
# Default: 30
|
||||
max-func-lines: 1
|
||||
nolintlint:
|
||||
# Enable to require an explanation of nonzero length after each nolint directive.
|
||||
# Default: false
|
||||
|
|
@ -268,9 +276,6 @@ linters-settings:
|
|||
- name: var-declaration
|
||||
- name: var-naming
|
||||
- name: waitgroup-by-value
|
||||
nakedret:
|
||||
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
|
||||
max-func-lines: 1
|
||||
tenv:
|
||||
# The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.
|
||||
# Otherwise, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
|
||||
|
|
@ -280,9 +285,11 @@ linters-settings:
|
|||
# Disable all checkers (https://github.com/Antonboom/testifylint#checkers).
|
||||
# Default: false
|
||||
disable-all: true
|
||||
# Enable specific checkers.
|
||||
# https://github.com/Antonboom/testifylint#checkers
|
||||
# Default: ["bool-compare", "compares", "empty", "error-is-as", "error-nil", "expected-actual", "float-compare", "len", "require-error", "suite-dont-use-pkg", "suite-extra-assert-call"]
|
||||
# Enable checkers by name
|
||||
# (in addition to default
|
||||
# blank-import, bool-compare, compares, empty, error-is-as, error-nil, expected-actual, go-require, float-compare,
|
||||
# len, nil-compare, require-error, suite-dont-use-pkg, suite-extra-assert-call, useless-assert
|
||||
# ).
|
||||
enable:
|
||||
- bool-compare
|
||||
- compares
|
||||
|
|
@ -297,40 +304,11 @@ linters-settings:
|
|||
- suite-thelper
|
||||
|
||||
run:
|
||||
# timeout for analysis, e.g. 30s, 5m, default is 1m
|
||||
# Timeout for analysis, e.g. 30s, 5m.
|
||||
# Default: 1m
|
||||
timeout: 10m
|
||||
|
||||
# which dirs to skip: issues from them won't be reported;
|
||||
# can use regexp here: generated.*, regexp is applied on full path;
|
||||
# default value is empty list, but default dirs are skipped independently
|
||||
# from this option's value (see skip-dirs-use-default).
|
||||
# "/" will be replaced by current OS file path separator to properly work
|
||||
# on Windows.
|
||||
skip-dirs:
|
||||
- assets
|
||||
- docs
|
||||
- etc
|
||||
|
||||
# which files to skip: they will be analyzed, but issues from them
|
||||
# won't be reported. Default value is empty list, but there is
|
||||
# no need to include all autogenerated files, we confidently recognize
|
||||
# autogenerated files. If it's not please let us know.
|
||||
# "/" will be replaced by current OS file path separator to properly work
|
||||
# on Windows.
|
||||
skip-files:
|
||||
- plugins/parsers/influx/machine.go*
|
||||
|
||||
# Show statistics per linter.
|
||||
# Default: false
|
||||
show-stats: true
|
||||
|
||||
issues:
|
||||
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
|
||||
max-issues-per-linter: 0
|
||||
|
||||
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
|
||||
max-same-issues: 0
|
||||
|
||||
# List of regexps of issue texts to exclude.
|
||||
#
|
||||
# But independently of this option we use default exclude patterns,
|
||||
|
|
@ -341,7 +319,7 @@ issues:
|
|||
exclude:
|
||||
# revive:var-naming
|
||||
- don't use an underscore in package name
|
||||
# EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
|
||||
# EXC0001 errcheck: Almost all programs ignore errors on these functions, and in most cases it's ok
|
||||
- Error return value of .((os\.)?std(out|err)\..*|.*Close.*|.*Flush|.*Disconnect|.*Clear|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
|
||||
# EXC0013 revive: Annoying issue about not having a comment. The rare codebase has such comments
|
||||
- package comment should be of the form "(.+)...
|
||||
|
|
@ -366,22 +344,66 @@ issues:
|
|||
# Independently of option `exclude` we use default exclude patterns,
|
||||
# it can be disabled by this option.
|
||||
# To list all excluded by default patterns execute `golangci-lint run --help`.
|
||||
# Default: true.
|
||||
# Default: true
|
||||
exclude-use-default: false
|
||||
|
||||
# Which dirs to exclude: issues from them won't be reported.
|
||||
# Can use regexp here: `generated.*`, regexp is applied on full path,
|
||||
# including the path prefix if one is set.
|
||||
# Default dirs are skipped independently of this option's value (see exclude-dirs-use-default).
|
||||
# "/" will be replaced by current OS file path separator to properly work on Windows.
|
||||
# Default: []
|
||||
exclude-dirs:
|
||||
- assets
|
||||
- docs
|
||||
- etc
|
||||
|
||||
# Which files to exclude: they will be analyzed, but issues from them won't be reported.
|
||||
# There is no need to include all autogenerated files,
|
||||
# we confidently recognize autogenerated files.
|
||||
# If it's not, please let us know.
|
||||
# "/" will be replaced by current OS file path separator to properly work on Windows.
|
||||
# Default: []
|
||||
exclude-files:
|
||||
- plugins/parsers/influx/machine.go*
|
||||
|
||||
# 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
|
||||
|
||||
# output configuration options
|
||||
output:
|
||||
# Format: colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
|
||||
#
|
||||
# Multiple can be specified by separating them by comma, output can be provided
|
||||
# for each of them by separating format name and path by colon symbol.
|
||||
# The formats used to render issues.
|
||||
# Format: `colored-line-number`, `line-number`, `json`, `colored-tab`, `tab`, `checkstyle`, `code-climate`, `junit-xml`, `github-actions`, `teamcity`
|
||||
# Output path can be either `stdout`, `stderr` or path to the file to write to.
|
||||
# Example: "checkstyle:report.json,colored-line-number"
|
||||
#
|
||||
# Default: colored-line-number
|
||||
format: tab
|
||||
# For the CLI flag (`--out-format`), multiple formats can be specified by separating them by comma.
|
||||
# The output can be specified for each of them by separating format name and path by colon symbol.
|
||||
# Example: "--out-format=checkstyle:report.xml,json:stdout,colored-line-number"
|
||||
# The CLI flag (`--out-format`) override the configuration file.
|
||||
#
|
||||
# Default:
|
||||
# formats:
|
||||
# - format: colored-line-number
|
||||
# path: stdout
|
||||
formats:
|
||||
- format: tab
|
||||
path: stdout
|
||||
|
||||
# Make issues output unique by line.
|
||||
# Default: true
|
||||
uniq-by-line: false
|
||||
# Sort results by: filepath, line and column.
|
||||
|
||||
# Sort results by the order defined in `sort-order`.
|
||||
# Default: false
|
||||
sort-results: true
|
||||
|
||||
# Show statistics per linter.
|
||||
# Default: false
|
||||
show-stats: true
|
||||
|
|
|
|||
2
Makefile
2
Makefile
|
|
@ -174,7 +174,7 @@ vet:
|
|||
.PHONY: lint-install
|
||||
lint-install:
|
||||
@echo "Installing golangci-lint"
|
||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.1
|
||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2
|
||||
|
||||
@echo "Installing markdownlint"
|
||||
npm install -g markdownlint-cli
|
||||
|
|
|
|||
|
|
@ -230,7 +230,6 @@ func (p *Ping) pingToURLNative(destination string, acc telegraf.Accumulator) {
|
|||
fields["ttl"] = stats.ttl
|
||||
}
|
||||
|
||||
//nolint:unconvert // Conversion may be needed for float64 https://github.com/mdempsky/unconvert/issues/40
|
||||
fields["percent_packet_loss"] = float64(stats.PacketLoss)
|
||||
fields["minimum_response_ms"] = float64(stats.MinRtt) / float64(time.Millisecond)
|
||||
fields["average_response_ms"] = float64(stats.AvgRtt) / float64(time.Millisecond)
|
||||
|
|
|
|||
Loading…
Reference in New Issue