diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 8652bf787b4b..e91ff502d8e4 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -7,13 +7,24 @@ assignees: ''
---
+
- [ ] Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
- [ ] Yes, I've searched similar issues on GitHub and didn't find any.
- [ ] Yes, I've included all information below (version, config, etc).
+- [ ] Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)
+
+
+Description of the problem
+
+Your description
+
+
Version of golangci-lint
@@ -51,3 +62,11 @@ $ golangci-lint run -v
```
+
+Code example or link to a public repository
+
+```go
+// add your code here
+```
+
+
diff --git a/.github/workflows/pr-extra.yml b/.github/workflows/pr-extra.yml
index d574137565e1..a9481391312f 100644
--- a/.github/workflows/pr-extra.yml
+++ b/.github/workflows/pr-extra.yml
@@ -16,4 +16,4 @@ jobs:
- name: Run go list
run: go list -json -m all > go.list
- name: Nancy
- uses: sonatype-nexus-community/nancy-github-action@1.0.1
+ uses: sonatype-nexus-community/nancy-github-action@v1.0.2
diff --git a/.golangci.example.yml b/.golangci.example.yml
index 4f06698e2308..8c55ddb27301 100644
--- a/.golangci.example.yml
+++ b/.golangci.example.yml
@@ -231,7 +231,7 @@ linters-settings:
regexp:
# define here regexp type values, for example
# AUTHOR: .*@mycompany\.com
- template: # |
+ template: # |-
# put here copyright header template for source code files, for example:
# Note: {{ YEAR }} is a builtin value that returns the year relative to the current machine time.
#
@@ -297,6 +297,7 @@ linters-settings:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
# enable or disable analyzers by name
+ # run `go tool vet help` to see all analyzers
enable:
- atomicalign
enable-all: false
@@ -443,6 +444,11 @@ linters-settings:
- ginkgo\\.F.* # these are used just for local development
# Exclude godoc examples from forbidigo checks. Default is true.
exclude_godoc_examples: false
+ importas:
+ # using `servingv1` alias for `knative.dev/serving/pkg/apis/serving/v1` package
+ servingv1: knative.dev/serving/pkg/apis/serving/v1
+ # using `autoscalingv1alpha1` alias for `knative.dev/serving/pkg/apis/autoscaling/v1alpha1` package
+ autoscalingv1alpha1: knative.dev/serving/pkg/apis/autoscaling/v1alpha1
# The custom section can be used to define linter plugins to be loaded at runtime. See README doc
# for more info.
diff --git a/.golangci.yml b/.golangci.yml
index d8806b143a0e..f2fcc17cc0fa 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -88,7 +88,6 @@ linters:
- gosimple
- govet
- ineffassign
- - interfacer
- lll
- misspell
- nakedret
@@ -113,6 +112,7 @@ linters:
# - godot
# - godox
# - goerr113
+ # - interfacer
# - maligned
# - nestif
# - prealloc
@@ -139,6 +139,18 @@ issues:
- path: pkg/golinters/scopelint.go
text: 'directive `//nolint:interfacer` is unused for linter interfacer'
+ # TODO temporary rule, must be removed
+ # related to https://github.com/golangci/golangci-lint/pull/1756
+ # must be replaced by '//nolint:staticcheck // require changes in github.com/OpenPeeDeeP/depguard'
+ - path: pkg/golinters/depguard.go
+ text: 'SA1019: package golang.org/x/tools/go/loader is deprecated'
+
+ # TODO temporary rule, must be removed
+ # related to https://github.com/golangci/golangci-lint/pull/1756
+ # must be replaced by '///nolint:staticcheck // it's an adapter for golang.org/x/tools/go/packages'
+ - path: pkg/golinters/goanalysis/adapters.go
+ text: 'SA1019: package golang.org/x/tools/go/loader is deprecated'
+
run:
skip-dirs:
- test/testdata_etc
diff --git a/docs/src/docs/usage/configuration.mdx b/docs/src/docs/usage/configuration.mdx
index 94a9a94ed818..4a18b51757de 100644
--- a/docs/src/docs/usage/configuration.mdx
+++ b/docs/src/docs/usage/configuration.mdx
@@ -19,6 +19,12 @@ golangci-lint run -h
{.RunHelpText}
```
+When the `--cpu-profile-path` or `--mem-profile-path` arguments are specified, `golangci-lint` writes runtime profiling data
+in the format expected by the [pprof](https://github.com/google/pprof) visualization tool.
+
+When the `--trace-path` argument is specified, `golangci-lint` writes runtime tracing data in the format expected by
+the `go tool trace` command and visualization tool.
+
## Config File
GolangCI-Lint looks for config files in the following paths from the current working directory:
diff --git a/docs/src/docs/usage/integrations.mdx b/docs/src/docs/usage/integrations.mdx
index 9d59a0584cde..1d0290c0c647 100644
--- a/docs/src/docs/usage/integrations.mdx
+++ b/docs/src/docs/usage/integrations.mdx
@@ -17,7 +17,7 @@ title: Integrations
Using it in an editor without `--fast` can freeze your editor.
Golangci-lint automatically discovers `.golangci.yml` config for edited file: you don't need to configure it in VS Code settings.
-2. Sublime Text - [plugin](https://github.com/alecthomas/SublimeLinter-contrib-golang-cilint) for SublimeLinter.
+2. Sublime Text - [plugin](https://github.com/SublimeLinter/SublimeLinter-golangcilint) for SublimeLinter.
3. GoLand
- Install [plugin](https://plugins.jetbrains.com/plugin/12496-go-linter)
- Add [File Watcher](https://www.jetbrains.com/help/go/settings-tools-file-watchers.html) using existing `golangci-lint` template.
diff --git a/go.mod b/go.mod
index 14518a6a674a..63808eef14bb 100644
--- a/go.mod
+++ b/go.mod
@@ -5,14 +5,14 @@ go 1.13
require (
4d63.com/gochecknoglobals v0.0.0-20201008074935-acfc0b28355a
github.com/BurntSushi/toml v0.3.1
- github.com/Djarvur/go-err113 v0.0.0-20200511133814-5174e21577d5
+ github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24
github.com/OpenPeeDeeP/depguard v1.0.1
github.com/alexkohler/prealloc v0.0.0-20210204145425-77a5b5dd9799
github.com/ashanbrown/forbidigo v1.1.0
github.com/ashanbrown/makezero v0.0.0-20201205152432-7b7cdbb3025a
github.com/bkielbasa/cyclop v1.2.0
github.com/bombsimon/wsl/v3 v3.2.0
- github.com/charithe/durationcheck v0.0.4
+ github.com/charithe/durationcheck v0.0.6
github.com/daixiang0/gci v0.2.8
github.com/denis-tingajkin/go-header v0.4.2
github.com/esimonov/ifshort v1.0.1
@@ -23,19 +23,22 @@ require (
github.com/gofrs/flock v0.8.0
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a
- github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6
github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613
github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a
- github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc
github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca
github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770
github.com/golangci/revgrep v0.0.0-20210208091834-cd28932614b5
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4
- github.com/jgautheron/goconst v0.0.0-20201117150253-ccae5bf973f3
+ github.com/gordonklaus/ineffassign v0.0.0-20210225214923-2e10b2664254
+ github.com/gostaticanalysis/forcetypeassert v0.0.0-20200621232751-01d4955beaa5
+ github.com/gostaticanalysis/nilerr v0.1.1
+ github.com/jgautheron/goconst v1.4.0
github.com/jingyugao/rowserrcheck v0.0.0-20210130005344-c6a0c12dd98d
github.com/jirfag/go-printf-func-name v0.0.0-20191110105641-45db9963cdd3
- github.com/kulti/thelper v0.3.1
+ github.com/julz/importas v0.0.0-20210226073942-60b4fa260dd0
+ github.com/kisielk/errcheck v1.6.0
+ github.com/kulti/thelper v0.4.0
github.com/kunwardeep/paralleltest v1.0.2
github.com/kyoh86/exportloopref v0.1.8
github.com/maratori/testpackage v1.0.1
@@ -54,10 +57,11 @@ require (
github.com/polyfloyd/go-errorlint v0.0.0-20201127212506-19bd8db6546f
github.com/ryancurrah/gomodguard v1.2.0
github.com/ryanrolds/sqlclosecheck v0.3.0
+ github.com/sanposhiho/wastedassign v0.1.3
github.com/securego/gosec/v2 v2.6.1
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c
- github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada // v2.19.8
- github.com/sirupsen/logrus v1.7.0
+ github.com/shirou/gopsutil/v3 v3.21.1
+ github.com/sirupsen/logrus v1.8.0
github.com/sonatard/noctx v0.0.1
github.com/sourcegraph/go-diff v0.6.1
github.com/spf13/cobra v1.1.3
@@ -67,7 +71,7 @@ require (
github.com/stretchr/testify v1.7.0
github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2
github.com/tetafro/godot v1.4.4
- github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e
+ github.com/timakin/bodyclose v0.0.0-20200424151742-cb6215831a94
github.com/tomarrell/wrapcheck v0.0.0-20200807122107-df9e8bcb914d
github.com/tommy-muehle/go-mnd/v2 v2.3.1
github.com/ultraware/funlen v0.0.3
@@ -77,7 +81,7 @@ require (
golang.org/x/text v0.3.4 // indirect
golang.org/x/tools v0.1.0
gopkg.in/yaml.v2 v2.4.0
- honnef.co/go/tools v0.0.1-2020.1.6
+ honnef.co/go/tools v0.1.2
mvdan.cc/gofumpt v0.1.0
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
diff --git a/go.sum b/go.sum
index 70ad38f793f6..c55e3c1ee9f7 100644
--- a/go.sum
+++ b/go.sum
@@ -16,15 +16,15 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
-github.com/Djarvur/go-err113 v0.0.0-20200511133814-5174e21577d5 h1:XTrzB+F8+SpRmbhAH8HLxhiiG6nYNwaBZjrFps1oWEk=
-github.com/Djarvur/go-err113 v0.0.0-20200511133814-5174e21577d5/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs=
+github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM=
+github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs=
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/OpenPeeDeeP/depguard v1.0.1 h1:VlW4R6jmBIv3/u1JNlawEvJMM4J+dPORPaZasQee8Us=
github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM=
-github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8=
-github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
+github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk=
+github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alexkohler/prealloc v0.0.0-20210204145425-77a5b5dd9799 h1:PIWLjlnnNq9F44hAJcuOf0BKZGPjDE5GxSavQcXaBBg=
@@ -43,13 +43,11 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
github.com/bkielbasa/cyclop v1.2.0 h1:7Jmnh0yL2DjKfw28p86YTd/B4lRGcNuu12sKE35sM7A=
github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI=
-github.com/bombsimon/wsl/v3 v3.1.0 h1:E5SRssoBgtVFPcYWUOFJEcgaySgdtTNYzsSKDOY7ss8=
-github.com/bombsimon/wsl/v3 v3.1.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc=
github.com/bombsimon/wsl/v3 v3.2.0 h1:x3QUbwW7tPGcCNridvqmhSRthZMTALnkg5/1J+vaUas=
github.com/bombsimon/wsl/v3 v3.2.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
-github.com/charithe/durationcheck v0.0.4 h1:lD3ud3KJ2DaoL80EZ768cSBv3DS8Xr7nNgN+kgW1tts=
-github.com/charithe/durationcheck v0.0.4/go.mod h1:0oCYOIgY8Om3hZxPedxKn0mzy0rneKTWJhRm+r6Gl20=
+github.com/charithe/durationcheck v0.0.6 h1:Tsy7EppNow2pDC0jN7Hsmcb6mHd71ZbI1vFissRBtc0=
+github.com/charithe/durationcheck v0.0.6/go.mod h1:SSbRIBVfMjCi/kEB6K65XEA83D6prSM8ap1UCpNKtgg=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
@@ -87,8 +85,8 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
-github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E=
-github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
+github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=
+github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-toolsmith/astcast v1.0.0 h1:JojxlmI6STnFVG9yOImLeGREv8W2ocNUM+iOhR6jE7g=
@@ -136,14 +134,10 @@ github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4=
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM=
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk=
-github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6 h1:YYWNAGTKWhKpcLLt7aSj/odlKrSrelQwlovBpDuf19w=
-github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6/go.mod h1:DbHgvLiFKX1Sh2T1w8Q/h4NAI8MHIpzCdnBUDTXU3I0=
github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 h1:9kfjN3AdxcbsZBf8NjltjWihK2QfBBBZuv91cMFfDHw=
github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8=
github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a h1:iR3fYXUjHCR97qWS8ch1y9zPNsgXThGwjKPrYfqMPks=
github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU=
-github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc h1:gLLhTLMk2/SutryVJ6D4VZCU3CUqr8YloG7FPIBWFpI=
-github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc/go.mod h1:e5tpTHCfVze+7EpLEozzMB3eafxo2KT5veNg1k6byQU=
github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA=
github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg=
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA=
@@ -174,6 +168,8 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m
github.com/gookit/color v1.3.6/go.mod h1:R3ogXq2B9rTbXoSHJ1HyUVAZ3poOJHpd9nQmyGZsfvQ=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
+github.com/gordonklaus/ineffassign v0.0.0-20210225214923-2e10b2664254 h1:Nb2aRlC404yz7gQIfRZxX9/MLvQiqXyiBTJtgAy6yrI=
+github.com/gordonklaus/ineffassign v0.0.0-20210225214923-2e10b2664254/go.mod h1:M9mZEtGIsR1oDaZagNPNG9iq9n2HrhZ17dsXk73V3Lw=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE=
github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE=
@@ -183,6 +179,10 @@ github.com/gostaticanalysis/analysisutil v0.4.1/go.mod h1:18U/DLpRgIUd459wGxVHE0
github.com/gostaticanalysis/comment v1.3.0/go.mod h1:xMicKDx7XRXYdVwY9f9wQpDJVnqWxw9wCauCMKp+IBI=
github.com/gostaticanalysis/comment v1.4.1 h1:xHopR5L2lRz6OsjH4R2HG5wRhW9ySl3FsHIvi5pcXwc=
github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXfXAlTaRzuaNDlSado=
+github.com/gostaticanalysis/forcetypeassert v0.0.0-20200621232751-01d4955beaa5 h1:rx8127mFPqXXsfPSo8BwnIU97MKFZc89WHAHt8PwDVY=
+github.com/gostaticanalysis/forcetypeassert v0.0.0-20200621232751-01d4955beaa5/go.mod h1:qZEedyP/sY1lTGV1uJ3VhWZ2mqag3IkWsDHVbplHXak=
+github.com/gostaticanalysis/nilerr v0.1.1 h1:ThE+hJP0fEp4zWLkWHWcRyI2Od0p7DlgYG3Uqrmrcpk=
+github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
@@ -210,8 +210,8 @@ github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/J
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
-github.com/jgautheron/goconst v0.0.0-20201117150253-ccae5bf973f3 h1:7nkB9fLPMwtn/R6qfPcHileL/x9ydlhw8XyDrLI1ZXg=
-github.com/jgautheron/goconst v0.0.0-20201117150253-ccae5bf973f3/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4=
+github.com/jgautheron/goconst v1.4.0 h1:hp9XKUpe/MPyDamUbfsrGpe+3dnY2whNK4EtB86dvLM=
+github.com/jgautheron/goconst v1.4.0/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4=
github.com/jingyugao/rowserrcheck v0.0.0-20210130005344-c6a0c12dd98d h1:BYDZtm80MLJpTWalkwHxNnIbO/2akQHERcfLq4TbIWE=
github.com/jingyugao/rowserrcheck v0.0.0-20210130005344-c6a0c12dd98d/go.mod h1:/EZlaYCnEX24i7qdVhT9du5JrtFWYRQr67bVgR7JJC8=
github.com/jirfag/go-printf-func-name v0.0.0-20191110105641-45db9963cdd3 h1:jNYPNLe3d8smommaoQlK7LOA5ESyUJJ+Wf79ZtA7Vp4=
@@ -223,7 +223,11 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
+github.com/julz/importas v0.0.0-20210226073942-60b4fa260dd0 h1:exZBMUS/kB/AhxSj/9lIIxhqkCpXXdKScjFWQUTbi3M=
+github.com/julz/importas v0.0.0-20210226073942-60b4fa260dd0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
+github.com/kisielk/errcheck v1.6.0 h1:YTDO4pNy7AUN/021p+JGHycQyYNIyMoenM1YDVK6RlY=
+github.com/kisielk/errcheck v1.6.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
@@ -236,8 +240,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
-github.com/kulti/thelper v0.3.1 h1:zc7YOjjpl6jAJ2C0wduu+jLl+rOvAEt1w8yV9QMxjWQ=
-github.com/kulti/thelper v0.3.1/go.mod h1:vMu2Cizjy/grP+jmsvOFDx1kYP6+PD1lqg4Yu5exl2U=
+github.com/kulti/thelper v0.4.0 h1:2Nx7XbdbE/BYZeoip2mURKUdtHQRuy6Ug+wR7K9ywNM=
+github.com/kulti/thelper v0.4.0/go.mod h1:vMu2Cizjy/grP+jmsvOFDx1kYP6+PD1lqg4Yu5exl2U=
github.com/kunwardeep/paralleltest v1.0.2 h1:/jJRv0TiqPoEy/Y8dQxCFJhD56uS/pnvtatgTZBHokU=
github.com/kunwardeep/paralleltest v1.0.2/go.mod h1:ZPqNm1fVHPllh5LPVujzbVz1JN2GhLxSfY+oqUsvG30=
github.com/kyoh86/exportloopref v0.1.8 h1:5Ry/at+eFdkX9Vsdw3qU4YkvGtzuVfzT4X7S77LoN/M=
@@ -245,6 +249,8 @@ github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+s
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
+github.com/magefile/mage v1.10.0 h1:3HiXzCUY12kh9bIuyXShaVe529fJfyqoVM42o/uom2g=
+github.com/magefile/mage v1.10.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/maratori/testpackage v1.0.1 h1:QtJ5ZjqapShm0w5DosRjg0PRlSdAdlx+W6cCKoALdbQ=
@@ -355,22 +361,22 @@ github.com/ryancurrah/gomodguard v1.2.0/go.mod h1:rNqbC4TOIdUDcVMSIpNNAzTbzXAZa6
github.com/ryanrolds/sqlclosecheck v0.3.0 h1:AZx+Bixh8zdUBxUA1NxbxVAS78vTPq4rCb8OUZI9xFw=
github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0KCtEdgEkHwDbigdA=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
+github.com/sanposhiho/wastedassign v0.1.3 h1:qIMpTh4NGZYRbFJ+DSpLoVn8F4SLciX2afRvXPefC7w=
+github.com/sanposhiho/wastedassign v0.1.3/go.mod h1:LGpq5Hsv74QaqM47WtIsRSF/ik9kqk07kchgv66tLVE=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/securego/gosec/v2 v2.6.1 h1:+KCw+uz16FYfFyJ/A5aU6uP7mnrL+j1TbDnk1yN+8R0=
github.com/securego/gosec/v2 v2.6.1/go.mod h1:I76p3NTHBXsGhybUW+cEQ692q2Vp+A0Z6ZLzDIZy+Ao=
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU=
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs=
-github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada h1:WokF3GuxBeL+n4Lk4Fa8v9mbdjlrl7bHuneF4N1bk2I=
-github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc=
-github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U=
-github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc=
+github.com/shirou/gopsutil/v3 v3.21.1 h1:dA72XXj5WOXIZkAL2iYTKRVcNOOqh4yfLn9Rm7t8BMM=
+github.com/shirou/gopsutil/v3 v3.21.1/go.mod h1:igHnfak0qnw1biGeI2qKQvu0ZkwvEkUcCLlYhZzdr/4=
github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk=
github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
-github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
-github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
+github.com/sirupsen/logrus v1.8.0 h1:nfhvjKcUMhBMVqbKHJlk5RPrrfYr/NMo3692g0dwfWU=
+github.com/sirupsen/logrus v1.8.0/go.mod h1:4GuYW9TZmE769R5STWrRakJc4UqQ3+QQ95fyz7ENv1A=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
@@ -414,8 +420,8 @@ github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2 h1:Xr9gkxfOP0K
github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM=
github.com/tetafro/godot v1.4.4 h1:VAtLEoAMmopIzHVWVBrztjVWDeYm1OD/DKqhqXR4828=
github.com/tetafro/godot v1.4.4/go.mod h1:FVDd4JuKliW3UgjswZfJfHq4vAx0bD/Jd5brJjGeaz4=
-github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e h1:RumXZ56IrCj4CL+g1b9OL/oH0QnsF976bC8xQFYUD5Q=
-github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk=
+github.com/timakin/bodyclose v0.0.0-20200424151742-cb6215831a94 h1:ig99OeTyDwQWhPe2iw9lwfQVF1KB3Q4fpP3X7/2VBG8=
+github.com/timakin/bodyclose v0.0.0-20200424151742-cb6215831a94/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tomarrell/wrapcheck v0.0.0-20200807122107-df9e8bcb914d h1:3EZyvNUMsGD1QA8cu0STNn1L7I77rvhf2IhOcHYQhSw=
github.com/tomarrell/wrapcheck v0.0.0-20200807122107-df9e8bcb914d/go.mod h1:yiFB6fFoV7saXirUGfuK+cPtUh4NX/Hf5y2WC2lehu0=
@@ -534,6 +540,7 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201024232916-9f70ab9862d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -555,6 +562,7 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3
golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190321232350-e250d351ecad/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
@@ -574,11 +582,10 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20200117220505-0cba7a3a9ee9/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
-golang.org/x/tools v0.0.0-20200403190813-44a64ad78b9b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
-golang.org/x/tools v0.0.0-20200410194907-79a7a3126eef/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200414032229-332987a829c3/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200422022333-3d57cf2e726e/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
+golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200622203043-20e05c1c8ffa/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200624225443-88f3c62a19ff/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200625211823-6506e20df31f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
@@ -589,6 +596,7 @@ golang.org/x/tools v0.0.0-20200831203904-5a2aa26beb65/go.mod h1:Cj7w3i3Rnn0Xh82u
golang.org/x/tools v0.0.0-20201001104356-43ebab892c4c/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
golang.org/x/tools v0.0.0-20201002184944-ecd9fd270d5d/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
golang.org/x/tools v0.0.0-20201011145850-ed2f50202694/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
+golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201028025901-8cd080b735b3/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201114224030-61ea331ec02b/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201118003311-bd56c0adb394/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
@@ -657,8 +665,8 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
-honnef.co/go/tools v0.0.1-2020.1.6 h1:W18jzjh8mfPez+AwGLxmOImucz/IFjpNlrKVnaj2YVc=
-honnef.co/go/tools v0.0.1-2020.1.6/go.mod h1:pyyisuGw24ruLjrr1ddx39WE0y9OooInRzEYLhQB2YY=
+honnef.co/go/tools v0.1.2 h1:SMdYLJl312RXuxXziCCHhRsp/tvct9cGKey0yv95tZM=
+honnef.co/go/tools v0.1.2/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las=
mvdan.cc/gofumpt v0.1.0 h1:hsVv+Y9UsZ/mFZTxJZuHVI6shSQCtzZ11h1JEFPAZLw=
mvdan.cc/gofumpt v0.1.0/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48=
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I=
diff --git a/pkg/commands/executor.go b/pkg/commands/executor.go
index 0becc9900db6..7f4702ed6adc 100644
--- a/pkg/commands/executor.go
+++ b/pkg/commands/executor.go
@@ -205,7 +205,9 @@ func computeConfigSalt(cfg *config.Config) ([]byte, error) {
configData.WriteString("\nbuild-tags=%s" + strings.Join(cfg.Run.BuildTags, ","))
h := sha256.New()
- h.Write(configData.Bytes()) //nolint:errcheck
+ if _, err := h.Write(configData.Bytes()); err != nil {
+ return nil, err
+ }
return h.Sum(nil), nil
}
diff --git a/pkg/commands/run.go b/pkg/commands/run.go
index 357e274625eb..c255e24642a4 100644
--- a/pkg/commands/run.go
+++ b/pkg/commands/run.go
@@ -82,6 +82,11 @@ func initFlagSet(fs *pflag.FlagSet, cfg *config.Config, m *lintersdb.Manager, is
fs.StringVar(&oc.PathPrefix, "path-prefix", "", wh("Path prefix to add to output"))
hideFlag("print-welcome") // no longer used
+ fs.BoolVar(&cfg.InternalCmdTest, "internal-cmd-test", false, wh("Option is used only for testing golangci-lint command, don't use it"))
+ if err := fs.MarkHidden("internal-cmd-test"); err != nil {
+ panic(err)
+ }
+
// Run config
rc := &cfg.Run
fs.StringVar(&rc.ModulesDownloadMode, "modules-download-mode", "",
diff --git a/pkg/config/config.go b/pkg/config/config.go
index 0aae4914ecfd..202ae6bc44cb 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -275,6 +275,7 @@ type LintersSettings struct {
Ifshort IfshortSettings
Predeclared PredeclaredSettings
Cyclop Cyclop
+ ImportAs ImportAsSettings
Custom map[string]CustomLinterSettings
}
@@ -461,6 +462,8 @@ type Cyclop struct {
SkipTests bool `mapstructure:"skip-tests"`
}
+type ImportAsSettings map[string]string
+
var defaultLintersSettings = LintersSettings{
Lll: LllSettings{
LineLength: 120,
@@ -663,7 +666,8 @@ type Config struct {
Severity Severity
Version Version
- InternalTest bool // Option is used only for testing golangci-lint code, don't use it
+ InternalCmdTest bool `mapstructure:"internal-cmd-test"` // Option is used only for testing golangci-lint command, don't use it
+ InternalTest bool // Option is used only for testing golangci-lint code, don't use it
}
func NewDefault() *Config {
diff --git a/pkg/golinters/errcheck.go b/pkg/golinters/errcheck.go
index 7df11fc8739e..9aac7326a0ca 100644
--- a/pkg/golinters/errcheck.go
+++ b/pkg/golinters/errcheck.go
@@ -10,9 +10,10 @@ import (
"strings"
"sync"
- errcheck "github.com/golangci/errcheck/golangci"
+ "github.com/kisielk/errcheck/errcheck"
"github.com/pkg/errors"
"golang.org/x/tools/go/analysis"
+ "golang.org/x/tools/go/packages"
"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/fsutils"
@@ -23,12 +24,15 @@ import (
func NewErrcheck() *goanalysis.Linter {
const linterName = "errcheck"
+
var mu sync.Mutex
var res []goanalysis.Issue
+
analyzer := &analysis.Analyzer{
Name: linterName,
Doc: goanalysis.TheOnlyanalyzerDoc,
}
+
return goanalysis.NewLinter(
linterName,
"Errcheck is a program for checking for unchecked errors "+
@@ -36,38 +40,54 @@ func NewErrcheck() *goanalysis.Linter {
[]*analysis.Analyzer{analyzer},
nil,
).WithContextSetter(func(lintCtx *linter.Context) {
+ // copied from errcheck
+ checker, err := getChecker(&lintCtx.Settings().Errcheck)
+ if err != nil {
+ lintCtx.Log.Errorf("failed to get checker: %v", err)
+ return
+ }
+
+ checker.Tags = lintCtx.Cfg.Run.BuildTags
+
analyzer.Run = func(pass *analysis.Pass) (interface{}, error) {
- prog := goanalysis.MakeFakeLoaderProgram(pass)
- errCfg, err := genConfig(&lintCtx.Settings().Errcheck)
- if err != nil {
- return nil, err
- }
- errcheckIssues, err := errcheck.RunWithConfig(prog, errCfg)
- if err != nil {
- return nil, err
+ pkg := &packages.Package{
+ Fset: pass.Fset,
+ Syntax: pass.Files,
+ Types: pass.Pkg,
+ TypesInfo: pass.TypesInfo,
}
- if len(errcheckIssues) == 0 {
+ errcheckIssues := checker.CheckPackage(pkg).Unique()
+ if len(errcheckIssues.UncheckedErrors) == 0 {
return nil, nil
}
- issues := make([]goanalysis.Issue, 0, len(errcheckIssues))
- for _, i := range errcheckIssues {
+ issues := make([]goanalysis.Issue, len(errcheckIssues.UncheckedErrors))
+ for i, err := range errcheckIssues.UncheckedErrors {
var text string
- if i.FuncName != "" {
- text = fmt.Sprintf("Error return value of %s is not checked", formatCode(i.FuncName, lintCtx.Cfg))
+ if err.FuncName != "" {
+ text = fmt.Sprintf(
+ "Error return value of %s is not checked",
+ formatCode(err.SelectorName, lintCtx.Cfg),
+ )
} else {
text = "Error return value is not checked"
}
- issues = append(issues, goanalysis.NewIssue(&result.Issue{
- FromLinter: linterName,
- Text: text,
- Pos: i.Pos,
- }, pass))
+
+ issues[i] = goanalysis.NewIssue(
+ &result.Issue{
+ FromLinter: linterName,
+ Text: text,
+ Pos: err.Pos,
+ },
+ pass,
+ )
}
+
mu.Lock()
res = append(res, issues...)
mu.Unlock()
+
return nil, nil
}
}).WithIssuesReporter(func(*linter.Context) []goanalysis.Issue {
@@ -104,16 +124,23 @@ func parseIgnoreConfig(s string) (map[string]*regexp.Regexp, error) {
return cfg, nil
}
-func genConfig(errCfg *config.ErrcheckSettings) (*errcheck.Config, error) {
+func getChecker(errCfg *config.ErrcheckSettings) (*errcheck.Checker, error) {
ignoreConfig, err := parseIgnoreConfig(errCfg.Ignore)
if err != nil {
return nil, errors.Wrap(err, "failed to parse 'ignore' directive")
}
- c := &errcheck.Config{
- Ignore: ignoreConfig,
- Blank: errCfg.CheckAssignToBlank,
- Asserts: errCfg.CheckTypeAssertions,
+ checker := errcheck.Checker{
+ Exclusions: errcheck.Exclusions{
+ BlankAssignments: !errCfg.CheckAssignToBlank,
+ TypeAssertions: !errCfg.CheckTypeAssertions,
+ SymbolRegexpsByPackage: map[string]*regexp.Regexp{},
+ Symbols: append([]string{}, errcheck.DefaultExcludedSymbols...),
+ },
+ }
+
+ for pkg, re := range ignoreConfig {
+ checker.Exclusions.SymbolRegexpsByPackage[pkg] = re
}
if errCfg.Exclude != "" {
@@ -121,10 +148,11 @@ func genConfig(errCfg *config.ErrcheckSettings) (*errcheck.Config, error) {
if err != nil {
return nil, err
}
- c.Exclude = exclude
+
+ checker.Exclusions.Symbols = append(checker.Exclusions.Symbols, exclude...)
}
- return c, nil
+ return &checker, nil
}
func getFirstPathArg() string {
@@ -192,7 +220,7 @@ func setupConfigFileSearch(name string) []string {
return configSearchPaths
}
-func readExcludeFile(name string) (map[string]bool, error) {
+func readExcludeFile(name string) ([]string, error) {
var err error
var fh *os.File
@@ -205,13 +233,17 @@ func readExcludeFile(name string) (map[string]bool, error) {
if fh == nil {
return nil, errors.Wrapf(err, "failed reading exclude file: %s", name)
}
+
scanner := bufio.NewScanner(fh)
- exclude := make(map[string]bool)
+
+ var excludes []string
for scanner.Scan() {
- exclude[scanner.Text()] = true
+ excludes = append(excludes, scanner.Text())
}
+
if err := scanner.Err(); err != nil {
return nil, errors.Wrapf(err, "failed scanning file: %s", name)
}
- return exclude, nil
+
+ return excludes, nil
}
diff --git a/pkg/golinters/forcetypeassert.go b/pkg/golinters/forcetypeassert.go
new file mode 100644
index 000000000000..e1a94f68a4c1
--- /dev/null
+++ b/pkg/golinters/forcetypeassert.go
@@ -0,0 +1,19 @@
+package golinters
+
+import (
+ "github.com/gostaticanalysis/forcetypeassert"
+ "golang.org/x/tools/go/analysis"
+
+ "github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
+)
+
+func NewForceTypeAssert() *goanalysis.Linter {
+ a := forcetypeassert.Analyzer
+
+ return goanalysis.NewLinter(
+ a.Name,
+ "finds forced type assertions",
+ []*analysis.Analyzer{a},
+ nil,
+ ).WithLoadMode(goanalysis.LoadModeTypesInfo)
+}
diff --git a/pkg/golinters/goanalysis/linter.go b/pkg/golinters/goanalysis/linter.go
index f1cfcca8398c..2489c4abf4d1 100644
--- a/pkg/golinters/goanalysis/linter.go
+++ b/pkg/golinters/goanalysis/linter.go
@@ -220,18 +220,31 @@ func buildIssues(diags []Diagnostic, linterNameBuilder func(diag *Diagnostic) st
for i := range diags {
diag := &diags[i]
linterName := linterNameBuilder(diag)
+
var text string
if diag.Analyzer.Name == linterName {
text = diag.Message
} else {
text = fmt.Sprintf("%s: %s", diag.Analyzer.Name, diag.Message)
}
+
issues = append(issues, result.Issue{
FromLinter: linterName,
Text: text,
Pos: diag.Position,
Pkg: diag.Pkg,
})
+
+ if len(diag.Related) > 0 {
+ for _, info := range diag.Related {
+ issues = append(issues, result.Issue{
+ FromLinter: linterName,
+ Text: fmt.Sprintf("%s(related information): %s", diag.Analyzer.Name, info.Message),
+ Pos: diag.Pkg.Fset.Position(info.Pos),
+ Pkg: diag.Pkg,
+ })
+ }
+ }
}
return issues
}
diff --git a/pkg/golinters/gocritic.go b/pkg/golinters/gocritic.go
index ec2ac2976eb1..75eb7d30760f 100644
--- a/pkg/golinters/gocritic.go
+++ b/pkg/golinters/gocritic.go
@@ -33,7 +33,9 @@ func NewGocritic() *goanalysis.Linter {
}
return goanalysis.NewLinter(
gocriticName,
- "The most opinionated Go source code linter",
+ `Provides many diagnostics that check for bugs, performance and style issues.
+Extensible without recompilation through dynamic rules.
+Dynamic rules are written declaratively with AST patterns, filters, report message and optional suggestion.`,
[]*analysis.Analyzer{analyzer},
nil,
).WithContextSetter(func(lintCtx *linter.Context) {
diff --git a/pkg/golinters/govet.go b/pkg/golinters/govet.go
index 4e79c980b8ff..d51956cf6c14 100644
--- a/pkg/golinters/govet.go
+++ b/pkg/golinters/govet.go
@@ -15,6 +15,7 @@ import (
_ "golang.org/x/tools/go/analysis/passes/ctrlflow" // unused, internal analyzer
"golang.org/x/tools/go/analysis/passes/deepequalerrors"
"golang.org/x/tools/go/analysis/passes/errorsas"
+ "golang.org/x/tools/go/analysis/passes/fieldalignment"
"golang.org/x/tools/go/analysis/passes/findcall"
"golang.org/x/tools/go/analysis/passes/httpresponse"
"golang.org/x/tools/go/analysis/passes/ifaceassert"
@@ -55,6 +56,7 @@ var (
copylock.Analyzer,
deepequalerrors.Analyzer,
errorsas.Analyzer,
+ fieldalignment.Analyzer,
findcall.Analyzer,
httpresponse.Analyzer,
ifaceassert.Analyzer,
diff --git a/pkg/golinters/importas.go b/pkg/golinters/importas.go
new file mode 100644
index 000000000000..41fbcb71248b
--- /dev/null
+++ b/pkg/golinters/importas.go
@@ -0,0 +1,34 @@
+package golinters
+
+import (
+ "fmt"
+
+ "github.com/julz/importas" // nolint: misspell
+ "golang.org/x/tools/go/analysis"
+
+ "github.com/golangci/golangci-lint/pkg/config"
+ "github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
+ "github.com/golangci/golangci-lint/pkg/lint/linter"
+)
+
+func NewImportAs(settings *config.ImportAsSettings) *goanalysis.Linter {
+ analyzer := importas.Analyzer
+
+ return goanalysis.NewLinter(
+ analyzer.Name,
+ analyzer.Doc,
+ []*analysis.Analyzer{analyzer},
+ nil,
+ ).WithContextSetter(func(lintCtx *linter.Context) {
+ if settings == nil {
+ return
+ }
+
+ for alias, pkg := range *settings {
+ err := analyzer.Flags.Set("alias", fmt.Sprintf("%s:%s", pkg, alias))
+ if err != nil {
+ lintCtx.Log.Errorf("failed to parse configuration: %v", err)
+ }
+ }
+ }).WithLoadMode(goanalysis.LoadModeTypesInfo)
+}
diff --git a/pkg/golinters/ineffassign.go b/pkg/golinters/ineffassign.go
index 93c1fb11bbb8..d25adeea5cc1 100644
--- a/pkg/golinters/ineffassign.go
+++ b/pkg/golinters/ineffassign.go
@@ -1,61 +1,17 @@
package golinters
import (
- "fmt"
- "sync"
-
- "github.com/golangci/ineffassign"
+ "github.com/gordonklaus/ineffassign/pkg/ineffassign"
"golang.org/x/tools/go/analysis"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
- "github.com/golangci/golangci-lint/pkg/lint/linter"
- "github.com/golangci/golangci-lint/pkg/result"
)
-const ineffassignName = "ineffassign"
-
func NewIneffassign() *goanalysis.Linter {
- var mu sync.Mutex
- var resIssues []goanalysis.Issue
-
- analyzer := &analysis.Analyzer{
- Name: ineffassignName,
- Doc: goanalysis.TheOnlyanalyzerDoc,
- }
return goanalysis.NewLinter(
- ineffassignName,
+ "ineffassign",
"Detects when assignments to existing variables are not used",
- []*analysis.Analyzer{analyzer},
+ []*analysis.Analyzer{ineffassign.Analyzer},
nil,
- ).WithContextSetter(func(lintCtx *linter.Context) {
- analyzer.Run = func(pass *analysis.Pass) (interface{}, error) {
- var fileNames []string
- for _, f := range pass.Files {
- pos := pass.Fset.PositionFor(f.Pos(), false)
- fileNames = append(fileNames, pos.Filename)
- }
-
- issues := ineffassign.Run(fileNames)
- if len(issues) == 0 {
- return nil, nil
- }
-
- res := make([]goanalysis.Issue, 0, len(issues))
- for _, i := range issues {
- res = append(res, goanalysis.NewIssue(&result.Issue{
- Pos: i.Pos,
- Text: fmt.Sprintf("ineffectual assignment to %s", formatCode(i.IdentName, lintCtx.Cfg)),
- FromLinter: ineffassignName,
- }, pass))
- }
-
- mu.Lock()
- resIssues = append(resIssues, res...)
- mu.Unlock()
-
- return nil, nil
- }
- }).WithIssuesReporter(func(*linter.Context) []goanalysis.Issue {
- return resIssues
- }).WithLoadMode(goanalysis.LoadModeSyntax)
+ ).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
diff --git a/pkg/golinters/nilerr.go b/pkg/golinters/nilerr.go
new file mode 100644
index 000000000000..d8a9a613eff4
--- /dev/null
+++ b/pkg/golinters/nilerr.go
@@ -0,0 +1,18 @@
+package golinters
+
+import (
+ "github.com/gostaticanalysis/nilerr"
+ "golang.org/x/tools/go/analysis"
+
+ "github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
+)
+
+func NewNilErr() *goanalysis.Linter {
+ a := nilerr.Analyzer
+ return goanalysis.NewLinter(
+ a.Name,
+ "Finds the code that returns nil even if it checks that the error is not nil.",
+ []*analysis.Analyzer{a},
+ nil,
+ ).WithLoadMode(goanalysis.LoadModeTypesInfo)
+}
diff --git a/pkg/golinters/revive.go b/pkg/golinters/revive.go
index c1d4bbae9d24..0420731fd395 100644
--- a/pkg/golinters/revive.go
+++ b/pkg/golinters/revive.go
@@ -109,7 +109,7 @@ func NewRevive(cfg *config.ReviveSettings) *goanalysis.Linter {
for i := range results {
issues = append(issues, goanalysis.NewIssue(&result.Issue{
Severity: string(results[i].Severity),
- Text: fmt.Sprintf("%q", results[i].Failure.Failure),
+ Text: fmt.Sprintf("%s: %s", results[i].RuleName, results[i].Failure.Failure),
Pos: token.Position{
Filename: results[i].Position.Start.Filename,
Line: results[i].Position.Start.Line,
diff --git a/pkg/golinters/unused.go b/pkg/golinters/unused.go
index bbe1e4b6903d..6998ebde053f 100644
--- a/pkg/golinters/unused.go
+++ b/pkg/golinters/unused.go
@@ -1,10 +1,10 @@
package golinters
import (
- "go/types"
+ "fmt"
+ "sync"
"golang.org/x/tools/go/analysis"
- "golang.org/x/tools/go/packages"
"honnef.co/go/tools/unused"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
@@ -13,53 +13,53 @@ import (
)
func NewUnused() *goanalysis.Linter {
- u := unused.NewChecker(false)
- analyzers := []*analysis.Analyzer{u.Analyzer()}
+ const name = "unused"
+
+ var mu sync.Mutex
+ var resIssues []goanalysis.Issue
+
+ analyzer := &analysis.Analyzer{
+ Name: name,
+ Doc: unused.Analyzer.Doc,
+ Requires: unused.Analyzer.Requires,
+ Run: func(pass *analysis.Pass) (interface{}, error) {
+ res, err := unused.Analyzer.Run(pass)
+ if err != nil {
+ return nil, err
+ }
+
+ sr := unused.Serialize(pass, res.(unused.Result), pass.Fset)
+
+ var issues []goanalysis.Issue
+ for _, object := range sr.Unused {
+ issue := goanalysis.NewIssue(&result.Issue{
+ FromLinter: name,
+ Text: fmt.Sprintf("%s %s is unused", object.Kind, object.Name),
+ Pos: object.Position,
+ }, pass)
+
+ issues = append(issues, issue)
+ }
+
+ mu.Lock()
+ resIssues = append(resIssues, issues...)
+ mu.Unlock()
+
+ return nil, nil
+ },
+ }
+
+ analyzers := []*analysis.Analyzer{analyzer}
setAnalyzersGoVersion(analyzers)
- const name = "unused"
lnt := goanalysis.NewLinter(
name,
"Checks Go code for unused constants, variables, functions and types",
analyzers,
nil,
).WithIssuesReporter(func(lintCtx *linter.Context) []goanalysis.Issue {
- typesToPkg := map[*types.Package]*packages.Package{}
- for _, pkg := range lintCtx.OriginalPackages {
- typesToPkg[pkg.Types] = pkg
- }
+ return resIssues
+ }).WithLoadMode(goanalysis.LoadModeSyntax | goanalysis.LoadModeTypesInfo)
- var issues []goanalysis.Issue
- for _, ur := range u.Result() {
- p := u.ProblemObject(lintCtx.Packages[0].Fset, ur)
- pkg := typesToPkg[ur.Pkg()]
- i := &result.Issue{
- FromLinter: name,
- Text: p.Message,
- Pos: p.Pos,
- Pkg: pkg,
- LineRange: &result.Range{
- From: p.Pos.Line,
- To: p.End.Line,
- },
- }
- // See https://github.com/golangci/golangci-lint/issues/1048
- // If range is invalid, this will break `--fix` mode.
- if i.LineRange.To >= i.LineRange.From {
- i.Replacement = &result.Replacement{
- // Suggest deleting unused stuff.
- NeedOnlyDelete: true,
- }
- }
- issues = append(issues, goanalysis.NewIssue(i, nil))
- }
- return issues
- }).WithContextSetter(func(lintCtx *linter.Context) {
- if lintCtx.Settings().Unused.CheckExported {
- lintCtx.Log.Infof("Using whole program analysis for unused, it can be memory-heavy")
- u.WholeProgram = true
- }
- }).WithLoadMode(goanalysis.LoadModeWholeProgram)
- lnt.UseOriginalPackages()
return lnt
}
diff --git a/pkg/golinters/wastedassign.go b/pkg/golinters/wastedassign.go
new file mode 100644
index 000000000000..9ce1afdd4810
--- /dev/null
+++ b/pkg/golinters/wastedassign.go
@@ -0,0 +1,21 @@
+package golinters
+
+import (
+ "github.com/sanposhiho/wastedassign"
+ "golang.org/x/tools/go/analysis"
+
+ "github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
+)
+
+func NewWastedAssign() *goanalysis.Linter {
+ analyzers := []*analysis.Analyzer{
+ wastedassign.Analyzer,
+ }
+
+ return goanalysis.NewLinter(
+ "wastedassign",
+ "wastedassign finds wasted assignment statements.",
+ analyzers,
+ nil,
+ ).WithLoadMode(goanalysis.LoadModeTypesInfo)
+}
diff --git a/pkg/lint/linter/config.go b/pkg/lint/linter/config.go
index 4ec835254f7d..86f78e5a4b8e 100644
--- a/pkg/lint/linter/config.go
+++ b/pkg/lint/linter/config.go
@@ -22,10 +22,11 @@ type Config struct {
InPresets []string
AlternativeNames []string
- OriginalURL string // URL of original (not forked) repo, needed for autogenerated README
- CanAutoFix bool
- IsSlow bool
- DoesChangeTypes bool
+ OriginalURL string // URL of original (not forked) repo, needed for autogenerated README
+ CanAutoFix bool
+ IsSlow bool
+ DoesChangeTypes bool
+ DeprecatedMessage string
}
func (lc *Config) ConsiderSlow() *Config {
@@ -73,6 +74,15 @@ func (lc *Config) WithChangeTypes() *Config {
return lc
}
+func (lc *Config) Deprecated(message string) *Config {
+ lc.DeprecatedMessage = message
+ return lc
+}
+
+func (lc *Config) IsDeprecated() bool {
+ return lc.DeprecatedMessage != ""
+}
+
func (lc *Config) AllNames() []string {
return append([]string{lc.Name()}, lc.AlternativeNames...)
}
diff --git a/pkg/lint/lintersdb/manager.go b/pkg/lint/lintersdb/manager.go
index bdf7a870441b..950d96942826 100644
--- a/pkg/lint/lintersdb/manager.go
+++ b/pkg/lint/lintersdb/manager.go
@@ -99,6 +99,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
var ifshortCfg *config.IfshortSettings
var reviveCfg *config.ReviveSettings
var cyclopCfg *config.Cyclop
+ var importAsCfg *config.ImportAsSettings
if m.cfg != nil {
govetCfg = &m.cfg.LintersSettings.Govet
testpackageCfg = &m.cfg.LintersSettings.Testpackage
@@ -110,6 +111,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
ifshortCfg = &m.cfg.LintersSettings.Ifshort
reviveCfg = &m.cfg.LintersSettings.Revive
cyclopCfg = &m.cfg.LintersSettings.Cyclop
+ importAsCfg = &m.cfg.LintersSettings.ImportAs
}
const megacheckName = "megacheck"
lcs := []*linter.Config{
@@ -177,12 +179,14 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
linter.NewConfig(golinters.NewInterfacer()).
WithLoadForGoAnalysis().
WithPresets(linter.PresetStyle).
- WithURL("https://github.com/mvdan/interfacer"),
+ WithURL("https://github.com/mvdan/interfacer").
+ Deprecated("The repository of the linter has been archived by the owner."),
linter.NewConfig(golinters.NewUnconvert()).
WithLoadForGoAnalysis().
WithPresets(linter.PresetStyle).
WithURL("https://github.com/mdempsky/unconvert"),
linter.NewConfig(golinters.NewIneffassign()).
+ WithLoadForGoAnalysis().
WithPresets(linter.PresetUnused).
WithURL("https://github.com/gordonklaus/ineffassign"),
linter.NewConfig(golinters.NewDupl()).
@@ -237,7 +241,8 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
linter.NewConfig(golinters.NewMaligned()).
WithLoadForGoAnalysis().
WithPresets(linter.PresetPerformance).
- WithURL("https://github.com/mdempsky/maligned"),
+ WithURL("https://github.com/mdempsky/maligned").
+ Deprecated("The repository of the linter has been archived by the owner. Use govet 'fieldalignment' instead."),
linter.NewConfig(golinters.NewDepguard()).
WithLoadForGoAnalysis().
WithPresets(linter.PresetStyle).
@@ -373,6 +378,22 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
WithPresets(linter.PresetBugs).
WithLoadForGoAnalysis().
WithURL("https://github.com/charithe/durationcheck"),
+ linter.NewConfig(golinters.NewWastedAssign()).
+ WithPresets(linter.PresetStyle).
+ WithLoadForGoAnalysis().
+ WithURL("https://github.com/sanposhiho/wastedassign"),
+ linter.NewConfig(golinters.NewImportAs(importAsCfg)).
+ WithPresets(linter.PresetStyle).
+ WithLoadForGoAnalysis().
+ WithURL("https://github.com/julz/importas"),
+ linter.NewConfig(golinters.NewNilErr()).
+ WithLoadForGoAnalysis().
+ WithPresets(linter.PresetBugs).
+ WithURL("https://github.com/gostaticanalysis/nilerr"),
+ linter.NewConfig(golinters.NewForceTypeAssert()).
+ WithPresets(linter.PresetStyle).
+ WithLoadForGoAnalysis().
+ WithURL("https://github.com/gostaticanalysis/forcetypeassert"),
// nolintlint must be last because it looks at the results of all the previous linters for unused nolint directives
linter.NewConfig(golinters.NewNoLintLint()).
diff --git a/pkg/lint/runner.go b/pkg/lint/runner.go
index 63e6ad710742..5788474705db 100644
--- a/pkg/lint/runner.go
+++ b/pkg/lint/runner.go
@@ -8,6 +8,7 @@ import (
"strings"
"github.com/pkg/errors"
+ gopackages "golang.org/x/tools/go/packages"
"github.com/golangci/golangci-lint/internal/errorutil"
"github.com/golangci/golangci-lint/pkg/config"
@@ -20,8 +21,6 @@ import (
"github.com/golangci/golangci-lint/pkg/result"
"github.com/golangci/golangci-lint/pkg/result/processors"
"github.com/golangci/golangci-lint/pkg/timeutils"
-
- gopackages "golang.org/x/tools/go/packages"
)
type Runner struct {
@@ -50,6 +49,15 @@ func NewRunner(cfg *config.Config, log logutils.Log, goenv *goutil.Env, es *lint
return nil, errors.Wrap(err, "failed to get enabled linters")
}
+ // print deprecated messages
+ if !cfg.InternalCmdTest {
+ for name, lc := range enabledLinters {
+ if lc.IsDeprecated() {
+ log.Warnf("The linter '%s' is deprecated due to: %s", name, lc.DeprecatedMessage)
+ }
+ }
+ }
+
return &Runner{
Processors: []processors.Processor{
processors.NewCgo(goenv),
diff --git a/scripts/expand_website_templates/main.go b/scripts/expand_website_templates/main.go
index 7705f96f2c90..edc1dec3c2dd 100644
--- a/scripts/expand_website_templates/main.go
+++ b/scripts/expand_website_templates/main.go
@@ -55,7 +55,9 @@ func updateStateFile(replacements map[string]string) error {
}
h := sha256.New()
- h.Write(replBytes) //nolint:errcheck
+ if _, err := h.Write(replBytes); err != nil {
+ return err
+ }
var contentBuf bytes.Buffer
contentBuf.WriteString("This file stores hash of website templates to trigger " +
diff --git a/test/bench/bench_test.go b/test/bench/bench_test.go
index 77e4e5dca01c..9cf73f0abf00 100644
--- a/test/bench/bench_test.go
+++ b/test/bench/bench_test.go
@@ -14,9 +14,8 @@ import (
"time"
gops "github.com/mitchellh/go-ps"
- "github.com/shirou/gopsutil/process"
+ "github.com/shirou/gopsutil/v3/process"
- "github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/test/testshared"
)
@@ -36,7 +35,7 @@ func prepareGithubProject(owner, name string) func(*testing.B) {
_, err := os.Stat(dir)
if os.IsNotExist(err) {
repo := fmt.Sprintf("https://github.com/%s/%s.git", owner, name)
- err = exec.Command("git", "clone", repo).Run()
+ err = exec.Command("git", "clone", repo, dir).Run()
if err != nil {
b.Fatalf("can't git clone %s/%s: %s", owner, name, err)
}
@@ -56,7 +55,6 @@ func getBenchLintersArgsNoMegacheck() []string {
"--enable=errcheck",
"--enable=dupl",
"--enable=ineffassign",
- "--enable=interfacer",
"--enable=unconvert",
"--enable=goconst",
"--enable=gosec",
@@ -69,21 +67,6 @@ func getBenchLintersArgs() []string {
}, getBenchLintersArgsNoMegacheck()...)
}
-func getGometalinterCommonArgs() []string {
- return []string{
- "--deadline=30m",
- "--skip=testdata",
- "--skip=builtin",
- "--vendor",
- "--cyclo-over=30",
- "--dupl-threshold=150",
- "--exclude", fmt.Sprintf("(%s)", strings.Join(config.GetDefaultExcludePatternsStrings(), "|")),
- "--disable-all",
- "--enable=vet",
- "--enable=vetshadow",
- }
-}
-
func printCommand(cmd string, args ...string) {
if os.Getenv("PRINT_CMD") != "1" {
return
@@ -96,16 +79,6 @@ func printCommand(cmd string, args ...string) {
log.Printf("%s %s", cmd, strings.Join(quotedArgs, " "))
}
-func runGometalinter(b *testing.B) {
- args := []string{}
- args = append(args, getGometalinterCommonArgs()...)
- args = append(args, getBenchLintersArgs()...)
- args = append(args, "./...")
-
- printCommand("gometalinter", args...)
- _ = exec.Command("gometalinter", args...).Run()
-}
-
func getGolangciLintCommonArgs() []string {
return []string{"run", "--no-config", "--issues-exit-code=0", "--deadline=30m", "--disable-all", "--enable=govet"}
}
@@ -211,20 +184,6 @@ type runResult struct {
duration time.Duration
}
-func compare(b *testing.B, gometalinterRun, golangciLintRun func(*testing.B), repoName, mode string, kLOC int) {
- gometalinterRes := runOne(b, gometalinterRun, "gometalinter")
- golangciLintRes := runOne(b, golangciLintRun, "golangci-lint")
-
- if mode != "" {
- mode = " " + mode
- }
- log.Printf("%s (%d kLoC): golangci-lint%s: time: %s, %.1f times faster; memory: %dMB, %.1f times less",
- repoName, kLOC, mode,
- golangciLintRes.duration, gometalinterRes.duration.Seconds()/golangciLintRes.duration.Seconds(),
- golangciLintRes.peakMemMB, float64(gometalinterRes.peakMemMB)/float64(golangciLintRes.peakMemMB),
- )
-}
-
func runOne(b *testing.B, run func(*testing.B), progName string) *runResult {
doneCh := make(chan struct{})
peakMemCh := trackPeakMemoryUsage(b, doneCh, progName)
@@ -240,7 +199,7 @@ func runOne(b *testing.B, run func(*testing.B), progName string) *runResult {
}
}
-func BenchmarkWithGometalinter(b *testing.B) {
+func BenchmarkGolangciLint(b *testing.B) {
testshared.NewLintRunner(b).Install()
type bcase struct {
@@ -252,10 +211,6 @@ func BenchmarkWithGometalinter(b *testing.B) {
name: "self repo",
prepare: prepareGithubProject("golangci", "golangci-lint"),
},
- {
- name: "gometalinter repo",
- prepare: prepareGithubProject("alecthomas", "gometalinter"),
- },
{
name: "hugo",
prepare: prepareGithubProject("gohugoio", "hugo"),
@@ -284,7 +239,12 @@ func BenchmarkWithGometalinter(b *testing.B) {
for _, bc := range bcases {
bc.prepare(b)
lc := getGoLinesTotalCount(b)
+ result := runOne(b, runGolangciLintForBench, "golangci-lint")
- compare(b, runGometalinter, runGolangciLintForBench, bc.name, "", lc/1000)
+ log.Printf("%s (%d kLoC): time: %s, memory: %dMB",
+ bc.name, lc/1000,
+ result.duration,
+ result.peakMemMB,
+ )
}
}
diff --git a/test/run_test.go b/test/run_test.go
index c9bd7a801b0e..34a0736651f5 100644
--- a/test/run_test.go
+++ b/test/run_test.go
@@ -135,7 +135,7 @@ func TestSortedResults(t *testing.T) {
"--sort-results=false",
strings.Join([]string{
"testdata/sort_results/main.go:12:5: `db` is unused (deadcode)",
- "testdata/sort_results/main.go:15:13: Error return value of `returnError` is not checked (errcheck)",
+ "testdata/sort_results/main.go:15:13: Error return value is not checked (errcheck)",
"testdata/sort_results/main.go:8:6: func `returnError` is unused (unused)",
}, "\n"),
},
@@ -144,7 +144,7 @@ func TestSortedResults(t *testing.T) {
strings.Join([]string{
"testdata/sort_results/main.go:8:6: func `returnError` is unused (unused)",
"testdata/sort_results/main.go:12:5: `db` is unused (deadcode)",
- "testdata/sort_results/main.go:15:13: Error return value of `returnError` is not checked (errcheck)",
+ "testdata/sort_results/main.go:15:13: Error return value is not checked (errcheck)",
}, "\n"),
},
}
@@ -185,8 +185,6 @@ func TestLintFilesWithLineDirective(t *testing.T) {
Run("-Egomodguard", "--disable-all", "--config=testdata/linedirective/gomodguard.yml", getTestDataDir("linedirective")).
ExpectHasIssue("import of package `github.com/ryancurrah/gomodguard` is blocked because the module is not " +
"in the allowed modules list. (gomodguard)")
- r.Run("-Eineffassign", "--disable-all", "--no-config", getTestDataDir("linedirective")).
- ExpectHasIssue("ineffectual assignment to `x` (ineffassign)")
r.Run("-Elll", "--disable-all", "--config=testdata/linedirective/lll.yml", getTestDataDir("linedirective")).
ExpectHasIssue("line is 57 characters (lll)")
r.Run("-Emisspell", "--disable-all", "--no-config", getTestDataDir("linedirective")).
diff --git a/test/testdata/configs/importas.yml b/test/testdata/configs/importas.yml
new file mode 100644
index 000000000000..698f00b7f5c3
--- /dev/null
+++ b/test/testdata/configs/importas.yml
@@ -0,0 +1,4 @@
+linters-settings:
+ importas:
+ fff: fmt
+ std_os: os
diff --git a/test/testdata/errcheck.go b/test/testdata/errcheck.go
index 0d6c118bd36a..dc4343507a09 100644
--- a/test/testdata/errcheck.go
+++ b/test/testdata/errcheck.go
@@ -12,7 +12,7 @@ func RetErr() error {
}
func MissedErrorCheck() {
- RetErr() // ERROR "Error return value of `RetErr` is not checked"
+ RetErr() // ERROR "Error return value is not checked"
}
func IgnoreCloseMissingErrHandling() error {
diff --git a/test/testdata/errcheck_ignore.go b/test/testdata/errcheck_ignore.go
index 197f46ed7e06..8528d78bae32 100644
--- a/test/testdata/errcheck_ignore.go
+++ b/test/testdata/errcheck_ignore.go
@@ -12,8 +12,8 @@ func TestErrcheckIgnoreOs() {
_, _ = os.Open("f.txt")
}
-func TestErrcheckNoIgnoreFmt(s string) int {
- n, _ := fmt.Println(s) // ERROR "Error return value of `fmt.Println` is not checked"
+func TestErrcheckIgnoreFmt(s string) int {
+ n, _ := fmt.Println(s)
return n
}
diff --git a/test/testdata/errcheck_ignore_default.go b/test/testdata/errcheck_ignore_default.go
index da59c6d0f9e2..18b090c20eb8 100644
--- a/test/testdata/errcheck_ignore_default.go
+++ b/test/testdata/errcheck_ignore_default.go
@@ -3,10 +3,17 @@
package testdata
import (
+ "crypto/sha256"
"fmt"
"os"
)
+func TestErrcheckIgnoreHashWriteByDefault() []byte {
+ h := sha256.New()
+ h.Write([]byte("food"))
+ return h.Sum(nil)
+}
+
func TestErrcheckIgnoreFmtByDefault(s string) int {
n, _ := fmt.Println(s)
return n
diff --git a/test/testdata/errcheck_type_assertions.go b/test/testdata/errcheck_type_assertions.go
new file mode 100644
index 000000000000..a85d69ddfbfd
--- /dev/null
+++ b/test/testdata/errcheck_type_assertions.go
@@ -0,0 +1,7 @@
+//args: -Eerrcheck
+//config: linters-settings.errcheck.check-type-assertions=true
+package testdata
+
+func ErrorTypeAssertion(filter map[string]interface{}) bool {
+ return filter["messages_sent.messageid"].(map[string]interface{})["$ne"] != nil
+}
diff --git a/test/testdata/forcetypeassert.go b/test/testdata/forcetypeassert.go
new file mode 100644
index 000000000000..6febae596907
--- /dev/null
+++ b/test/testdata/forcetypeassert.go
@@ -0,0 +1,20 @@
+//args: -Eforcetypeassert
+package testdata
+
+import "fmt"
+
+func forcetypeassertInvalid() {
+ var a interface{}
+ _ = a.(int) // ERROR "type assertion must be checked"
+
+ var b interface{}
+ bi := b.(int) // ERROR "type assertion must be checked"
+ fmt.Println(bi)
+}
+
+func forcetypeassertValid() {
+ var a interface{}
+ if ai, ok := a.(int); ok {
+ fmt.Println(ai)
+ }
+}
diff --git a/test/testdata/goerr113.go b/test/testdata/goerr113.go
index c1b7c04f18d6..6c76c232ef4a 100644
--- a/test/testdata/goerr113.go
+++ b/test/testdata/goerr113.go
@@ -4,18 +4,18 @@ package testdata
import "os"
func SimpleEqual(e1, e2 error) bool {
- return e1 == e2 // ERROR `err113: do not compare errors directly, use errors.Is\(\) instead: "e1 == e2"`
+ return e1 == e2 // ERROR `err113: do not compare errors directly "e1 == e2", use "errors.Is\(e1, e2\)" instead`
}
func SimpleNotEqual(e1, e2 error) bool {
- return e1 != e2 // ERROR `err113: do not compare errors directly, use errors.Is\(\) instead: "e1 != e2"`
+ return e1 != e2 // ERROR `err113: do not compare errors directly "e1 != e2", use "!errors.Is\(e1, e2\)" instead`
}
func CheckGoerr13Import(e error) bool {
f, err := os.Create("f.txt")
if err != nil {
- return err == e // ERROR `err113: do not compare errors directly, use errors.Is\(\) instead: "err == e"`
+ return err == e // ERROR `err113: do not compare errors directly "err == e", use "errors.Is\(err, e\)" instead`
}
f.Close()
return false
-}
\ No newline at end of file
+}
diff --git a/test/testdata/govet_fieldalignment.go b/test/testdata/govet_fieldalignment.go
new file mode 100644
index 000000000000..618e3f6e1fc7
--- /dev/null
+++ b/test/testdata/govet_fieldalignment.go
@@ -0,0 +1,57 @@
+//args: -Egovet
+//config: linters-settings.govet.enable=fieldalignment
+package testdata
+
+type gvfaGood struct {
+ y int32
+ x byte
+ z byte
+}
+
+type gvfaBad struct { // ERROR "struct of size 12 could be 8"
+ x byte
+ y int32
+ z byte
+}
+
+type gvfaPointerGood struct {
+ P *int
+ buf [1000]uintptr
+}
+
+type gvfaPointerBad struct { // ERROR "struct with 8008 pointer bytes could be 8"
+ buf [1000]uintptr
+ P *int
+}
+
+type gvfaPointerSorta struct {
+ a struct {
+ p *int
+ q uintptr
+ }
+ b struct {
+ p *int
+ q [2]uintptr
+ }
+}
+
+type gvfaPointerSortaBad struct { // ERROR "struct with 32 pointer bytes could be 24"
+ a struct {
+ p *int
+ q [2]uintptr
+ }
+ b struct {
+ p *int
+ q uintptr
+ }
+}
+
+type gvfaZeroGood struct {
+ a [0]byte
+ b uint32
+}
+
+type gvfaZeroBad struct { // ERROR "struct of size 8 could be 4"
+ a uint32
+ b [0]byte
+}
diff --git a/test/testdata/importas.go b/test/testdata/importas.go
new file mode 100644
index 000000000000..ee560c1c3a3e
--- /dev/null
+++ b/test/testdata/importas.go
@@ -0,0 +1,13 @@
+//args: -Eimportas
+//config_path: testdata/configs/importas.yml
+package testdata
+
+import (
+ wrong_alias "fmt" // ERROR `import "fmt" imported as "wrong_alias" but must be "fff" according to config`
+ wrong_alias_again "os" // ERROR `import "os" imported as "wrong_alias_again" but must be "std_os" according to config`
+)
+
+func ImportAsWrongAlias() {
+ wrong_alias.Println("foo")
+ wrong_alias_again.Stdout.WriteString("bar")
+}
diff --git a/test/testdata/ineffassign.go b/test/testdata/ineffassign.go
index a792b6f6be50..69d3cc81c9c1 100644
--- a/test/testdata/ineffassign.go
+++ b/test/testdata/ineffassign.go
@@ -1,11 +1,13 @@
//args: -Eineffassign
package testdata
+import "math"
+
func _() {
- x := 0
+ x := math.MinInt8
for {
_ = x
- x = 0 // ERROR "ineffectual assignment to `x`"
+ x = 0 // ERROR "ineffectual assignment to x"
x = 0
}
}
diff --git a/test/testdata/interfacer.go b/test/testdata/interfacer.go
index 55b1e291d0f7..ef8010aa229f 100644
--- a/test/testdata/interfacer.go
+++ b/test/testdata/interfacer.go
@@ -1,4 +1,4 @@
-//args: -Einterfacer
+//args: -Einterfacer --internal-cmd-test
package testdata
import "io"
diff --git a/test/testdata/maligned.go b/test/testdata/maligned.go
index 129123ddab36..7dbc781fb164 100644
--- a/test/testdata/maligned.go
+++ b/test/testdata/maligned.go
@@ -1,4 +1,4 @@
-//args: -Emaligned
+//args: -Emaligned --internal-cmd-test
package testdata
type BadAlignedStruct struct { // ERROR "struct of size 24 bytes could be of size 16 bytes"
diff --git a/test/testdata/nilerr.go b/test/testdata/nilerr.go
new file mode 100644
index 000000000000..6475f663faa2
--- /dev/null
+++ b/test/testdata/nilerr.go
@@ -0,0 +1,35 @@
+//args: -Enilerr
+package testdata
+
+import "os"
+
+func nilErr1() error {
+ err := nilErrDo()
+ if err == nil {
+ return err // ERROR `error is nil \(line 7\) but it returns error`
+ }
+
+ return nil
+}
+
+func nilErr2() error {
+ err := nilErrDo()
+ if err == nil {
+ return err // ERROR `error is nil \(line 16\) but it returns error`
+ }
+
+ return nil
+}
+
+func nilErr3() error {
+ err := nilErrDo()
+ if err != nil {
+ return nil // ERROR `error is not nil \(line 25\) but it returns nil`
+ }
+
+ return nil
+}
+
+func nilErrDo() error {
+ return os.ErrNotExist
+}
diff --git a/test/testdata/revive.go b/test/testdata/revive.go
index 224880b36524..83e3d18d3c7e 100644
--- a/test/testdata/revive.go
+++ b/test/testdata/revive.go
@@ -7,7 +7,7 @@ import "time"
func testRevive(t *time.Duration) error {
if t == nil {
return nil
- } else { // ERROR "if block ends with a return statement, so drop this else and outdent its block"
+ } else { // ERROR "indent-error-flow: if block ends with a return statement, .*"
return nil
}
}
diff --git a/test/testdata/staticcheck.go b/test/testdata/staticcheck.go
index 5ab2d78cba4c..d20f26efdb8c 100644
--- a/test/testdata/staticcheck.go
+++ b/test/testdata/staticcheck.go
@@ -23,7 +23,7 @@ func StaticcheckNolintMegacheck() {
}
func StaticcheckDeprecated() {
- _ = runtime.CPUProfile() // ERROR "SA1019: runtime.CPUProfile is deprecated"
+ _ = runtime.CPUProfile() // ERROR "SA1019: runtime.CPUProfile has been deprecated .*"
}
func StaticcheckPrintf() {
diff --git a/test/testdata/unused.go b/test/testdata/unused.go
index 46c497292eec..1fa3c0b80a19 100644
--- a/test/testdata/unused.go
+++ b/test/testdata/unused.go
@@ -1,6 +1,19 @@
//args: -Eunused
package testdata
+func fn1() {} // ERROR "func `fn1` is unused"
+
+//nolint:unused
+func fn2() { fn3() }
+
+func fn3() {} // ERROR "func `fn3` is unused"
+
+func fn4() { fn5() } // ERROR "func `fn4` is unused"
+
+func fn5() {} // ERROR "func `fn5` is unused"
+
+func fn6() { fn4() } // ERROR "func `fn6` is unused"
+
type unusedStruct struct{} // ERROR "type `unusedStruct` is unused"
type unusedStructNolintUnused struct{} //nolint:unused
diff --git a/test/testdata/wastedassign.go b/test/testdata/wastedassign.go
new file mode 100644
index 000000000000..923ab7aae0ed
--- /dev/null
+++ b/test/testdata/wastedassign.go
@@ -0,0 +1,107 @@
+//args: -Ewastedassign
+package testdata
+
+import (
+ "strings"
+)
+
+func p(x int) int {
+ return x + 1
+}
+
+func typeSwitchNoError(val interface{}, times uint) interface{} {
+ switch hoge := val.(type) {
+ case int:
+ return 12
+ case string:
+ return strings.Repeat(hoge, int(times))
+ default:
+ return nil
+ }
+}
+
+func noUseParamsNoError(params string) int {
+ a := 12
+ println(a)
+ return a
+}
+
+func manyif(param int) int {
+ println(param)
+ useOutOfIf := 1212121 // ERROR "wasted assignment"
+ ret := 0
+ if false {
+ useOutOfIf = 200 // ERROR "reassigned, but never used afterwards"
+ return 0
+ } else if param == 100 {
+ useOutOfIf = 100 // ERROR "wasted assignment"
+ useOutOfIf = 201
+ useOutOfIf = p(useOutOfIf)
+ useOutOfIf += 200 // ERROR "wasted assignment"
+ } else {
+ useOutOfIf = 100
+ useOutOfIf += 100
+ useOutOfIf = p(useOutOfIf)
+ useOutOfIf += 200 // ERROR "wasted assignment"
+ }
+
+ if false {
+ useOutOfIf = 200 // ERROR "reassigned, but never used afterwards"
+ return 0
+ } else if param == 200 {
+ useOutOfIf = 100 // ERROR "wasted assignment"
+ useOutOfIf = 201
+ useOutOfIf = p(useOutOfIf)
+ useOutOfIf += 200
+ } else {
+ useOutOfIf = 100
+ useOutOfIf += 100
+ useOutOfIf = p(useOutOfIf)
+ useOutOfIf += 200
+ }
+ println(useOutOfIf)
+ useOutOfIf = 192
+ useOutOfIf += 100
+ useOutOfIf += 200 // ERROR "reassigned, but never used afterwards"
+ return ret
+}
+
+func checkLoopTest() int {
+ hoge := 12
+ noUse := 1111
+ println(noUse)
+
+ noUse = 1111 // ERROR "reassigned, but never used afterwards"
+ for {
+ if hoge == 14 {
+ break
+ }
+ hoge = hoge + 1
+ }
+ return hoge
+}
+
+func infinity() {
+ var i int
+ var hoge int
+ for {
+ hoge = 5 // ERROR "reassigned, but never used afterwards"
+ }
+
+ println(i)
+ println(hoge)
+ return
+}
+
+func infinity2() {
+ var i int
+ var hoge int
+ for {
+ hoge = 5
+ break
+ }
+
+ println(i)
+ println(hoge)
+ return
+}
diff --git a/test/testshared/testshared.go b/test/testshared/testshared.go
index 8effe2bad0bf..c1a89d697e54 100644
--- a/test/testshared/testshared.go
+++ b/test/testshared/testshared.go
@@ -94,7 +94,9 @@ func (r *LintRunner) Run(args ...string) *RunResult {
func (r *LintRunner) RunCommand(command string, args ...string) *RunResult {
r.Install()
- runArgs := append([]string{command}, args...)
+ runArgs := append([]string{command}, "--internal-cmd-test")
+ runArgs = append(runArgs, args...)
+
defer func(startedAt time.Time) {
r.log.Infof("ran [../golangci-lint %s] in %s", strings.Join(runArgs, " "), time.Since(startedAt))
}(time.Now())