feat: inactivate deprecated linters ()

This commit is contained in:
Ludovic Fernandez 2024-03-03 20:40:52 +01:00 committed by GitHub
parent 3866470d41
commit a0878087fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
30 changed files with 114 additions and 1360 deletions

@ -369,16 +369,6 @@ linters-settings:
# Default: false # Default: false
default-case-required: true default-case-required: true
exhaustivestruct:
# Struct Patterns is list of expressions to match struct packages and names.
# The struct packages have the form `example.com/package.ExampleStruct`.
# The matching patterns can use matching syntax from https://pkg.go.dev/path#Match.
# If this list is empty, all structs are tested.
# Default: []
struct-patterns:
- '*.Test'
- 'example.com/package.ExampleStruct'
exhaustruct: exhaustruct:
# List of regular expressions to match struct packages and their names. # List of regular expressions to match struct packages and their names.
# Regular expressions must match complete canonical struct package/name/structname. # Regular expressions must match complete canonical struct package/name/structname.
@ -772,11 +762,6 @@ linters-settings:
# Default: "" # Default: ""
local-prefixes: github.com/org/project local-prefixes: github.com/org/project
golint:
# Minimal confidence for issues.
# Default: 0.8
min-confidence: 0.7
gomnd: gomnd:
# List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description. # List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.
# Default: ["argument", "case", "condition", "operation", "return", "assign"] # Default: ["argument", "case", "condition", "operation", "return", "assign"]
@ -1241,15 +1226,6 @@ linters-settings:
# Default: false # Default: false
var-require-grouping: true var-require-grouping: true
ifshort:
# Maximum length of variable declaration measured in number of lines, after which linter won't suggest using short syntax.
# Has higher priority than max-decl-chars.
# Default: 1
max-decl-lines: 2
# Maximum length of variable declaration measured in number of characters, after which linter won't suggest using short syntax.
# Default: 30
max-decl-chars: 40
importas: importas:
# Do not allow unaliased imports of aliased packages. # Do not allow unaliased imports of aliased packages.
# Default: false # Default: false
@ -1353,11 +1329,6 @@ linters-settings:
# Default: false # Default: false
always: true always: true
maligned:
# Print struct with more effective memory layout or not.
# Default: false
suggest-new: true
misspell: misspell:
# Correct spellings using locale preferences for US or UK. # Correct spellings using locale preferences for US or UK.
# Setting locale to US will correct the British spelling of 'colour' to 'color'. # Setting locale to US will correct the British spelling of 'colour' to 'color'.
@ -2338,11 +2309,6 @@ linters-settings:
# Default: true # Default: true
generated-is-used: false generated-is-used: false
varcheck:
# Check usage of exported fields and variables.
# Default: false
exported-fields: true
varnamelen: varnamelen:
# The longest distance, in source lines, that is being considered a "small scope". # The longest distance, in source lines, that is being considered a "small scope".
# Variables used in at most this many lines will be ignored. # Variables used in at most this many lines will be ignored.
@ -2519,7 +2485,6 @@ linters:
- contextcheck - contextcheck
- copyloopvar - copyloopvar
- cyclop - cyclop
- deadcode
- decorder - decorder
- depguard - depguard
- dogsled - dogsled
@ -2532,7 +2497,6 @@ linters:
- errorlint - errorlint
- execinquery - execinquery
- exhaustive - exhaustive
- exhaustivestruct
- exhaustruct - exhaustruct
- exportloopref - exportloopref
- forbidigo - forbidigo
@ -2555,7 +2519,6 @@ linters:
- gofumpt - gofumpt
- goheader - goheader
- goimports - goimports
- golint
- gomnd - gomnd
- gomoddirectives - gomoddirectives
- gomodguard - gomodguard
@ -2565,19 +2528,16 @@ linters:
- gosmopolitan - gosmopolitan
- govet - govet
- grouper - grouper
- ifshort
- importas - importas
- inamedparam - inamedparam
- ineffassign - ineffassign
- interfacebloat - interfacebloat
- interfacer
- intrange - intrange
- ireturn - ireturn
- lll - lll
- loggercheck - loggercheck
- maintidx - maintidx
- makezero - makezero
- maligned
- mirror - mirror
- misspell - misspell
- musttag - musttag
@ -2589,7 +2549,6 @@ linters:
- noctx - noctx
- nolintlint - nolintlint
- nonamedreturns - nonamedreturns
- nosnakecase
- nosprintfhostport - nosprintfhostport
- paralleltest - paralleltest
- perfsprint - perfsprint
@ -2600,12 +2559,10 @@ linters:
- reassign - reassign
- revive - revive
- rowserrcheck - rowserrcheck
- scopelint
- sloglint - sloglint
- spancheck - spancheck
- sqlclosecheck - sqlclosecheck
- staticcheck - staticcheck
- structcheck
- stylecheck - stylecheck
- tagalign - tagalign
- tagliatelle - tagliatelle
@ -2620,7 +2577,6 @@ linters:
- unparam - unparam
- unused - unused
- usestdlibvars - usestdlibvars
- varcheck
- varnamelen - varnamelen
- wastedassign - wastedassign
- whitespace - whitespace
@ -2642,7 +2598,6 @@ linters:
- contextcheck - contextcheck
- copyloopvar - copyloopvar
- cyclop - cyclop
- deadcode
- decorder - decorder
- depguard - depguard
- dogsled - dogsled
@ -2655,7 +2610,6 @@ linters:
- errorlint - errorlint
- execinquery - execinquery
- exhaustive - exhaustive
- exhaustivestruct
- exhaustruct - exhaustruct
- exportloopref - exportloopref
- forbidigo - forbidigo
@ -2678,7 +2632,6 @@ linters:
- gofumpt - gofumpt
- goheader - goheader
- goimports - goimports
- golint
- gomnd - gomnd
- gomoddirectives - gomoddirectives
- gomodguard - gomodguard
@ -2688,19 +2641,16 @@ linters:
- gosmopolitan - gosmopolitan
- govet - govet
- grouper - grouper
- ifshort
- importas - importas
- inamedparam - inamedparam
- ineffassign - ineffassign
- interfacebloat - interfacebloat
- interfacer
- intrange - intrange
- ireturn - ireturn
- lll - lll
- loggercheck - loggercheck
- maintidx - maintidx
- makezero - makezero
- maligned
- mirror - mirror
- misspell - misspell
- musttag - musttag
@ -2712,7 +2662,6 @@ linters:
- noctx - noctx
- nolintlint - nolintlint
- nonamedreturns - nonamedreturns
- nosnakecase
- nosprintfhostport - nosprintfhostport
- paralleltest - paralleltest
- perfsprint - perfsprint
@ -2723,12 +2672,10 @@ linters:
- reassign - reassign
- revive - revive
- rowserrcheck - rowserrcheck
- scopelint
- sloglint - sloglint
- spancheck - spancheck
- sqlclosecheck - sqlclosecheck
- staticcheck - staticcheck
- structcheck
- stylecheck - stylecheck
- tagalign - tagalign
- tagliatelle - tagliatelle
@ -2743,13 +2690,22 @@ linters:
- unparam - unparam
- unused - unused
- usestdlibvars - usestdlibvars
- varcheck
- varnamelen - varnamelen
- wastedassign - wastedassign
- whitespace - whitespace
- wrapcheck - wrapcheck
- wsl - wsl
- zerologlint - zerologlint
- deadcode # Deprecated
- exhaustivestruct # Deprecated
- golint # Deprecated
- ifshort # Deprecated
- interfacer # Deprecated
- maligned # Deprecated
- nosnakecase # Deprecated
- scopelint # Deprecated
- structcheck # Deprecated
- varcheck # Deprecated
# Enable presets. # Enable presets.
# https://golangci-lint.run/usage/linters # https://golangci-lint.run/usage/linters

9
go.mod

@ -33,7 +33,6 @@ require (
github.com/curioswitch/go-reassign v0.2.0 github.com/curioswitch/go-reassign v0.2.0
github.com/daixiang0/gci v0.13.0 github.com/daixiang0/gci v0.13.0
github.com/denis-tingaikin/go-header v0.5.0 github.com/denis-tingaikin/go-header v0.5.0
github.com/esimonov/ifshort v1.0.4
github.com/fatih/color v1.16.0 github.com/fatih/color v1.16.0
github.com/firefart/nonamedreturns v1.0.4 github.com/firefart/nonamedreturns v1.0.4
github.com/fzipp/gocyclo v0.6.0 github.com/fzipp/gocyclo v0.6.0
@ -42,12 +41,8 @@ require (
github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1
github.com/go-xmlfmt/xmlfmt v1.1.2 github.com/go-xmlfmt/xmlfmt v1.1.2
github.com/gofrs/flock v0.8.1 github.com/gofrs/flock v0.8.1
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a
github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe
github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e
github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca
github.com/golangci/misspell v0.4.1 github.com/golangci/misspell v0.4.1
github.com/golangci/revgrep v0.5.2 github.com/golangci/revgrep v0.5.2
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4
@ -76,7 +71,6 @@ require (
github.com/maratori/testpackage v1.1.1 github.com/maratori/testpackage v1.1.1
github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26
github.com/mattn/go-colorable v0.1.13 github.com/mattn/go-colorable v0.1.13
github.com/mbilski/exhaustivestruct v1.2.0
github.com/mgechev/revive v1.3.7 github.com/mgechev/revive v1.3.7
github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/go-ps v1.0.0 github.com/mitchellh/go-ps v1.0.0
@ -97,7 +91,6 @@ require (
github.com/shirou/gopsutil/v3 v3.24.2 github.com/shirou/gopsutil/v3 v3.24.2
github.com/sirupsen/logrus v1.9.3 github.com/sirupsen/logrus v1.9.3
github.com/sivchari/containedctx v1.0.3 github.com/sivchari/containedctx v1.0.3
github.com/sivchari/nosnakecase v1.7.0
github.com/sivchari/tenv v1.7.1 github.com/sivchari/tenv v1.7.1
github.com/sonatard/noctx v0.0.2 github.com/sonatard/noctx v0.0.2
github.com/sourcegraph/go-diff v0.7.0 github.com/sourcegraph/go-diff v0.7.0
@ -130,7 +123,6 @@ require (
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
honnef.co/go/tools v0.4.7 honnef.co/go/tools v0.4.7
mvdan.cc/gofumpt v0.6.0 mvdan.cc/gofumpt v0.6.0
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed
mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14 mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14
) )
@ -201,5 +193,4 @@ require (
google.golang.org/protobuf v1.31.0 // indirect google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
) )

19
go.sum generated

@ -133,8 +133,6 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA=
github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0=
github.com/ettle/strcase v0.2.0 h1:fGNiVF21fHXpX1niBgk0aROov1LagYsOwV/xqKDKR/Q= github.com/ettle/strcase v0.2.0 h1:fGNiVF21fHXpX1niBgk0aROov1LagYsOwV/xqKDKR/Q=
github.com/ettle/strcase v0.2.0/go.mod h1:DajmHElDSaX76ITe3/VHVyMin4LWSJN5Z909Wp+ED1A= github.com/ettle/strcase v0.2.0/go.mod h1:DajmHElDSaX76ITe3/VHVyMin4LWSJN5Z909Wp+ED1A=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
@ -227,18 +225,10 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0=
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 h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM=
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk=
github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6J5HIP8ZtyMdiDscjMLfRBSPuzVVeo=
github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ=
github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e h1:ULcKCDV1LOZPFxGZaA6TlQbiM3J2GCPnkx/bGF6sX/g= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e h1:ULcKCDV1LOZPFxGZaA6TlQbiM3J2GCPnkx/bGF6sX/g=
github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e/go.mod h1:Pm5KhLPA8gSnQwrQ6ukebRcapGb/BG9iUkdaiCcGHJM= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e/go.mod h1:Pm5KhLPA8gSnQwrQ6ukebRcapGb/BG9iUkdaiCcGHJM=
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=
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o=
github.com/golangci/misspell v0.4.1 h1:+y73iSicVy2PqyX7kmUefHusENlrP9YwuHZHPLGQj/g= github.com/golangci/misspell v0.4.1 h1:+y73iSicVy2PqyX7kmUefHusENlrP9YwuHZHPLGQj/g=
github.com/golangci/misspell v0.4.1/go.mod h1:9mAN1quEo3DlpbaIKKyEvRxK1pwqR9s/Sea1bJCtlNI= github.com/golangci/misspell v0.4.1/go.mod h1:9mAN1quEo3DlpbaIKKyEvRxK1pwqR9s/Sea1bJCtlNI=
github.com/golangci/revgrep v0.5.2 h1:EndcWoRhcnfj2NHQ+28hyuXpLMF+dQmCN+YaeeIl4FU= github.com/golangci/revgrep v0.5.2 h1:EndcWoRhcnfj2NHQ+28hyuXpLMF+dQmCN+YaeeIl4FU=
@ -379,8 +369,6 @@ github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/Qd
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo=
github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc=
github.com/mgechev/revive v1.3.7 h1:502QY0vQGe9KtYJ9FpxMz9rL+Fc/P13CI5POL4uHCcE= github.com/mgechev/revive v1.3.7 h1:502QY0vQGe9KtYJ9FpxMz9rL+Fc/P13CI5POL4uHCcE=
github.com/mgechev/revive v1.3.7/go.mod h1:RJ16jUbF0OWC3co/+XTxmFNgEpUPwnnA0BRllX2aDNA= github.com/mgechev/revive v1.3.7/go.mod h1:RJ16jUbF0OWC3co/+XTxmFNgEpUPwnnA0BRllX2aDNA=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
@ -500,8 +488,6 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sivchari/containedctx v1.0.3 h1:x+etemjbsh2fB5ewm5FeLNi5bUjK0V8n0RB+Wwfd0XE= github.com/sivchari/containedctx v1.0.3 h1:x+etemjbsh2fB5ewm5FeLNi5bUjK0V8n0RB+Wwfd0XE=
github.com/sivchari/containedctx v1.0.3/go.mod h1:c1RDvCbnJLtH4lLcYD/GqwiBSSf4F5Qk0xld2rBqzJ4= github.com/sivchari/containedctx v1.0.3/go.mod h1:c1RDvCbnJLtH4lLcYD/GqwiBSSf4F5Qk0xld2rBqzJ4=
github.com/sivchari/nosnakecase v1.7.0 h1:7QkpWIRMe8x25gckkFd2A5Pi6Ymo0qgr4JrhGt95do8=
github.com/sivchari/nosnakecase v1.7.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY=
github.com/sivchari/tenv v1.7.1 h1:PSpuD4bu6fSmtWMxSGWcvqUUgIn7k3yOJhOIzVWn8Ak= github.com/sivchari/tenv v1.7.1 h1:PSpuD4bu6fSmtWMxSGWcvqUUgIn7k3yOJhOIzVWn8Ak=
github.com/sivchari/tenv v1.7.1/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= github.com/sivchari/tenv v1.7.1/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg=
github.com/sonatard/noctx v0.0.2 h1:L7Dz4De2zDQhW8S0t+KUjY0MAQJd6SgVwhzNIc4ok00= github.com/sonatard/noctx v0.0.2 h1:L7Dz4De2zDQhW8S0t+KUjY0MAQJd6SgVwhzNIc4ok00=
@ -862,7 +848,6 @@ golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200820010801-b793a1359eac/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200820010801-b793a1359eac/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20201001104356-43ebab892c4c/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-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.1-0.20210205202024-ef80cdb6ec6d/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= golang.org/x/tools v0.1.1-0.20210205202024-ef80cdb6ec6d/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU=
@ -989,10 +974,6 @@ honnef.co/go/tools v0.4.7 h1:9MDAWxMoSnB6QoSqiVr7P5mtkT9pOc1kSxchzPCnqJs=
honnef.co/go/tools v0.4.7/go.mod h1:+rnGS1THNh8zMwnd2oVOTL9QF6vmfyG6ZXBULae2uc0= honnef.co/go/tools v0.4.7/go.mod h1:+rnGS1THNh8zMwnd2oVOTL9QF6vmfyG6ZXBULae2uc0=
mvdan.cc/gofumpt v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo= mvdan.cc/gofumpt v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo=
mvdan.cc/gofumpt v0.6.0/go.mod h1:4L0wf+kgIPZtcCWXynNS2e6bhmj73umwnuXSZarixzA= mvdan.cc/gofumpt v0.6.0/go.mod h1:4L0wf+kgIPZtcCWXynNS2e6bhmj73umwnuXSZarixzA=
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I=
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo=
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14 h1:zCr3iRRgdk5eIikZNDphGcM6KGVTx3Yu+/Uu9Es254w= mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14 h1:zCr3iRRgdk5eIikZNDphGcM6KGVTx3Yu+/Uu9Es254w=
mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14/go.mod h1:ZzZjEpJDOmx8TdVU6umamY3Xy0UAQUI2DHbf05USVbI= mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14/go.mod h1:ZzZjEpJDOmx8TdVU6umamY3Xy0UAQUI2DHbf05USVbI=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=

@ -81,9 +81,6 @@ var defaultLintersSettings = LintersSettings{
ModulePath: "", ModulePath: "",
ExtraRules: false, ExtraRules: false,
}, },
Golint: GoLintSettings{
MinConfidence: 0.8,
},
Gosec: GoSecSettings{ Gosec: GoSecSettings{
Concurrency: runtime.NumCPU(), Concurrency: runtime.NumCPU(),
}, },
@ -93,10 +90,6 @@ var defaultLintersSettings = LintersSettings{
IgnoreTests: true, IgnoreTests: true,
WatchForScripts: []string{"Han"}, WatchForScripts: []string{"Han"},
}, },
Ifshort: IfshortSettings{
MaxDeclLines: 1,
MaxDeclChars: 30,
},
Inamedparam: INamedParamSettings{ Inamedparam: INamedParamSettings{
SkipSingleParam: false, SkipSingleParam: false,
}, },
@ -217,7 +210,6 @@ type LintersSettings struct {
ErrChkJSON ErrChkJSONSettings ErrChkJSON ErrChkJSONSettings
ErrorLint ErrorLintSettings ErrorLint ErrorLintSettings
Exhaustive ExhaustiveSettings Exhaustive ExhaustiveSettings
ExhaustiveStruct ExhaustiveStructSettings
Exhaustruct ExhaustructSettings Exhaustruct ExhaustructSettings
Forbidigo ForbidigoSettings Forbidigo ForbidigoSettings
Funlen FunlenSettings Funlen FunlenSettings
@ -233,7 +225,6 @@ type LintersSettings struct {
Gofumpt GofumptSettings Gofumpt GofumptSettings
Goheader GoHeaderSettings Goheader GoHeaderSettings
Goimports GoImportsSettings Goimports GoImportsSettings
Golint GoLintSettings
Gomnd GoMndSettings Gomnd GoMndSettings
GoModDirectives GoModDirectivesSettings GoModDirectives GoModDirectivesSettings
Gomodguard GoModGuardSettings Gomodguard GoModGuardSettings
@ -242,7 +233,6 @@ type LintersSettings struct {
Gosmopolitan GosmopolitanSettings Gosmopolitan GosmopolitanSettings
Govet GovetSettings Govet GovetSettings
Grouper GrouperSettings Grouper GrouperSettings
Ifshort IfshortSettings
ImportAs ImportAsSettings ImportAs ImportAsSettings
Inamedparam INamedParamSettings Inamedparam INamedParamSettings
InterfaceBloat InterfaceBloatSettings InterfaceBloat InterfaceBloatSettings
@ -251,7 +241,6 @@ type LintersSettings struct {
LoggerCheck LoggerCheckSettings LoggerCheck LoggerCheckSettings
MaintIdx MaintIdxSettings MaintIdx MaintIdxSettings
Makezero MakezeroSettings Makezero MakezeroSettings
Maligned MalignedSettings
Misspell MisspellSettings Misspell MisspellSettings
MustTag MustTagSettings MustTag MustTagSettings
Nakedret NakedretSettings Nakedret NakedretSettings
@ -272,7 +261,6 @@ type LintersSettings struct {
SlogLint SlogLintSettings SlogLint SlogLintSettings
Spancheck SpancheckSettings Spancheck SpancheckSettings
Staticcheck StaticCheckSettings Staticcheck StaticCheckSettings
Structcheck StructCheckSettings
Stylecheck StaticCheckSettings Stylecheck StaticCheckSettings
TagAlign TagAlignSettings TagAlign TagAlignSettings
Tagliatelle TagliatelleSettings Tagliatelle TagliatelleSettings
@ -283,7 +271,6 @@ type LintersSettings struct {
Unparam UnparamSettings Unparam UnparamSettings
Unused UnusedSettings Unused UnusedSettings
UseStdlibVars UseStdlibVarsSettings UseStdlibVars UseStdlibVarsSettings
Varcheck VarCheckSettings
Varnamelen VarnamelenSettings Varnamelen VarnamelenSettings
Whitespace WhitespaceSettings Whitespace WhitespaceSettings
Wrapcheck WrapcheckSettings Wrapcheck WrapcheckSettings
@ -399,10 +386,6 @@ type ExhaustiveSettings struct {
DefaultCaseRequired bool `mapstructure:"default-case-required"` DefaultCaseRequired bool `mapstructure:"default-case-required"`
} }
type ExhaustiveStructSettings struct {
StructPatterns []string `mapstructure:"struct-patterns"`
}
type ExhaustructSettings struct { type ExhaustructSettings struct {
Include []string `mapstructure:"include"` Include []string `mapstructure:"include"`
Exclude []string `mapstructure:"exclude"` Exclude []string `mapstructure:"exclude"`
@ -549,10 +532,6 @@ type GoImportsSettings struct {
LocalPrefixes string `mapstructure:"local-prefixes"` LocalPrefixes string `mapstructure:"local-prefixes"`
} }
type GoLintSettings struct {
MinConfidence float64 `mapstructure:"min-confidence"`
}
type GoMndSettings struct { type GoMndSettings struct {
Settings map[string]map[string]any // Deprecated Settings map[string]map[string]any // Deprecated
Checks []string `mapstructure:"checks"` Checks []string `mapstructure:"checks"`
@ -638,11 +617,6 @@ type GrouperSettings struct {
VarRequireGrouping bool `mapstructure:"var-require-grouping"` VarRequireGrouping bool `mapstructure:"var-require-grouping"`
} }
type IfshortSettings struct {
MaxDeclLines int `mapstructure:"max-decl-lines"`
MaxDeclChars int `mapstructure:"max-decl-chars"`
}
type ImportAsSettings struct { type ImportAsSettings struct {
Alias []ImportAsAlias Alias []ImportAsAlias
NoUnaliased bool `mapstructure:"no-unaliased"` NoUnaliased bool `mapstructure:"no-unaliased"`
@ -690,10 +664,6 @@ type MakezeroSettings struct {
Always bool Always bool
} }
type MalignedSettings struct {
SuggestNewOrder bool `mapstructure:"suggest-new"`
}
type MisspellSettings struct { type MisspellSettings struct {
Mode string `mapstructure:"mode"` Mode string `mapstructure:"mode"`
Locale string `mapstructure:"locale"` Locale string `mapstructure:"locale"`
@ -838,10 +808,6 @@ func (s *StaticCheckSettings) HasConfiguration() bool {
return len(s.Initialisms) > 0 || len(s.HTTPStatusCodeWhitelist) > 0 || len(s.DotImportWhitelist) > 0 || len(s.Checks) > 0 return len(s.Initialisms) > 0 || len(s.HTTPStatusCodeWhitelist) > 0 || len(s.DotImportWhitelist) > 0 || len(s.Checks) > 0
} }
type StructCheckSettings struct {
CheckExportedFields bool `mapstructure:"exported-fields"`
}
type TagAlignSettings struct { type TagAlignSettings struct {
Align bool `mapstructure:"align"` Align bool `mapstructure:"align"`
Sort bool `mapstructure:"sort"` Sort bool `mapstructure:"sort"`
@ -931,10 +897,6 @@ type UnusedSettings struct {
GeneratedIsUsed bool `mapstructure:"generated-is-used"` GeneratedIsUsed bool `mapstructure:"generated-is-used"`
} }
type VarCheckSettings struct {
CheckExportedFields bool `mapstructure:"exported-fields"`
}
type VarnamelenSettings struct { type VarnamelenSettings struct {
MaxDistance int `mapstructure:"max-distance"` MaxDistance int `mapstructure:"max-distance"`
MinNameLength int `mapstructure:"min-name-length"` MinNameLength int `mapstructure:"min-name-length"`

@ -1,61 +0,0 @@
package golinters
import (
"fmt"
"sync"
deadcodeAPI "github.com/golangci/go-misc/deadcode"
"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 deadcodeName = "deadcode"
func NewDeadcode() *goanalysis.Linter {
var mu sync.Mutex
var resIssues []goanalysis.Issue
analyzer := &analysis.Analyzer{
Name: deadcodeName,
Doc: goanalysis.TheOnlyanalyzerDoc,
Run: func(pass *analysis.Pass) (any, error) {
prog := goanalysis.MakeFakeLoaderProgram(pass)
issues, err := deadcodeAPI.Run(prog)
if err != nil {
return nil, err
}
res := make([]goanalysis.Issue, 0, len(issues))
for _, i := range issues {
res = append(res, goanalysis.NewIssue(&result.Issue{
Pos: i.Pos,
Text: fmt.Sprintf("%s is unused", formatCode(i.UnusedIdentName, nil)),
FromLinter: deadcodeName,
}, pass))
}
if len(issues) == 0 {
return nil, nil
}
mu.Lock()
resIssues = append(resIssues, res...)
mu.Unlock()
return nil, nil
},
}
return goanalysis.NewLinter(
deadcodeName,
"Finds unused code",
[]*analysis.Analyzer{analyzer},
nil,
).WithIssuesReporter(func(*linter.Context) []goanalysis.Issue {
return resIssues
}).WithLoadMode(goanalysis.LoadModeTypesInfo)
}

@ -1,31 +0,0 @@
package golinters
import (
"strings"
"github.com/mbilski/exhaustivestruct/pkg/analyzer"
"golang.org/x/tools/go/analysis"
"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
)
func NewExhaustiveStruct(settings *config.ExhaustiveStructSettings) *goanalysis.Linter {
a := analyzer.Analyzer
var cfg map[string]map[string]any
if settings != nil {
cfg = map[string]map[string]any{
a.Name: {
"struct_patterns": strings.Join(settings.StructPatterns, ","),
},
}
}
return goanalysis.NewLinter(
a.Name,
a.Doc,
[]*analysis.Analyzer{a},
cfg,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
}

@ -1,84 +0,0 @@
package golinters
import (
"fmt"
"sync"
lintAPI "github.com/golangci/lint-1"
"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"
"github.com/golangci/golangci-lint/pkg/result"
)
const golintName = "golint"
//nolint:dupl
func NewGolint(settings *config.GoLintSettings) *goanalysis.Linter {
var mu sync.Mutex
var resIssues []goanalysis.Issue
analyzer := &analysis.Analyzer{
Name: golintName,
Doc: goanalysis.TheOnlyanalyzerDoc,
Run: func(pass *analysis.Pass) (any, error) {
issues, err := runGoLint(pass, settings)
if err != nil {
return nil, err
}
if len(issues) == 0 {
return nil, nil
}
mu.Lock()
resIssues = append(resIssues, issues...)
mu.Unlock()
return nil, nil
},
}
return goanalysis.NewLinter(
golintName,
"Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes",
[]*analysis.Analyzer{analyzer},
nil,
).WithIssuesReporter(func(*linter.Context) []goanalysis.Issue {
return resIssues
}).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
func runGoLint(pass *analysis.Pass, settings *config.GoLintSettings) ([]goanalysis.Issue, error) {
l := new(lintAPI.Linter)
ps, err := l.LintPkg(pass.Files, pass.Fset, pass.Pkg, pass.TypesInfo)
if err != nil {
return nil, fmt.Errorf("can't lint %d files: %w", len(pass.Files), err)
}
if len(ps) == 0 {
return nil, nil
}
lintIssues := make([]*result.Issue, 0, len(ps)) // This is worst case
for idx := range ps {
if ps[idx].Confidence >= settings.MinConfidence {
lintIssues = append(lintIssues, &result.Issue{
Pos: ps[idx].Position,
Text: ps[idx].Text,
FromLinter: golintName,
})
// TODO: use p.Link and p.Category
}
}
issues := make([]goanalysis.Issue, 0, len(lintIssues))
for _, issue := range lintIssues {
issues = append(issues, goanalysis.NewIssue(issue, pass))
}
return issues, nil
}

@ -1,30 +0,0 @@
package golinters
import (
"github.com/esimonov/ifshort/pkg/analyzer"
"golang.org/x/tools/go/analysis"
"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
)
func NewIfshort(settings *config.IfshortSettings) *goanalysis.Linter {
var cfg map[string]map[string]any
if settings != nil {
cfg = map[string]map[string]any{
analyzer.Analyzer.Name: {
"max-decl-lines": settings.MaxDeclLines,
"max-decl-chars": settings.MaxDeclChars,
},
}
}
a := analyzer.Analyzer
return goanalysis.NewLinter(
a.Name,
a.Doc,
[]*analysis.Analyzer{a},
cfg,
).WithLoadMode(goanalysis.LoadModeSyntax)
}

@ -1,82 +0,0 @@
package golinters
import (
"sync"
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/analysis/passes/buildssa"
"mvdan.cc/interfacer/check"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
"github.com/golangci/golangci-lint/pkg/lint/linter"
"github.com/golangci/golangci-lint/pkg/result"
)
const interfacerName = "interfacer"
func NewInterfacer() *goanalysis.Linter {
var mu sync.Mutex
var resIssues []goanalysis.Issue
analyzer := &analysis.Analyzer{
Name: interfacerName,
Doc: goanalysis.TheOnlyanalyzerDoc,
Requires: []*analysis.Analyzer{buildssa.Analyzer},
Run: func(pass *analysis.Pass) (any, error) {
issues, err := runInterfacer(pass)
if err != nil {
return nil, err
}
if len(issues) == 0 {
return nil, nil
}
mu.Lock()
resIssues = append(resIssues, issues...)
mu.Unlock()
return nil, nil
},
}
return goanalysis.NewLinter(
interfacerName,
"Linter that suggests narrower interface types",
[]*analysis.Analyzer{analyzer},
nil,
).WithIssuesReporter(func(*linter.Context) []goanalysis.Issue {
return resIssues
}).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
func runInterfacer(pass *analysis.Pass) ([]goanalysis.Issue, error) {
c := &check.Checker{}
prog := goanalysis.MakeFakeLoaderProgram(pass)
c.Program(prog)
ssa := pass.ResultOf[buildssa.Analyzer].(*buildssa.SSA)
ssaPkg := ssa.Pkg
c.ProgramSSA(ssaPkg.Prog)
lintIssues, err := c.Check()
if err != nil {
return nil, err
}
if len(lintIssues) == 0 {
return nil, nil
}
issues := make([]goanalysis.Issue, 0, len(lintIssues))
for _, i := range lintIssues {
pos := pass.Fset.Position(i.Pos())
issues = append(issues, goanalysis.NewIssue(&result.Issue{
Pos: pos,
Text: i.Message(),
FromLinter: interfacerName,
}, pass))
}
return issues, nil
}

@ -1,74 +0,0 @@
package golinters
import (
"fmt"
"sync"
malignedAPI "github.com/golangci/maligned"
"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"
"github.com/golangci/golangci-lint/pkg/result"
)
const malignedName = "maligned"
//nolint:dupl
func NewMaligned(settings *config.MalignedSettings) *goanalysis.Linter {
var mu sync.Mutex
var res []goanalysis.Issue
analyzer := &analysis.Analyzer{
Name: malignedName,
Doc: goanalysis.TheOnlyanalyzerDoc,
Run: func(pass *analysis.Pass) (any, error) {
issues := runMaligned(pass, settings)
if len(issues) == 0 {
return nil, nil
}
mu.Lock()
res = append(res, issues...)
mu.Unlock()
return nil, nil
},
}
return goanalysis.NewLinter(
malignedName,
"Tool to detect Go structs that would take less memory if their fields were sorted",
[]*analysis.Analyzer{analyzer},
nil,
).WithIssuesReporter(func(*linter.Context) []goanalysis.Issue {
return res
}).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
func runMaligned(pass *analysis.Pass, settings *config.MalignedSettings) []goanalysis.Issue {
prog := goanalysis.MakeFakeLoaderProgram(pass)
malignedIssues := malignedAPI.Run(prog)
if len(malignedIssues) == 0 {
return nil
}
issues := make([]goanalysis.Issue, 0, len(malignedIssues))
for _, i := range malignedIssues {
text := fmt.Sprintf("struct of size %d bytes could be of size %d bytes", i.OldSize, i.NewSize)
if settings.SuggestNewOrder {
text += fmt.Sprintf(":\n%s", formatCodeBlock(i.NewStructDef, nil))
}
issues = append(issues, goanalysis.NewIssue(&result.Issue{
Pos: i.Pos,
Text: text,
FromLinter: malignedName,
}, pass))
}
return issues
}

@ -1,19 +0,0 @@
package golinters
import (
"github.com/sivchari/nosnakecase"
"golang.org/x/tools/go/analysis"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
)
func NewNoSnakeCase() *goanalysis.Linter {
a := nosnakecase.Analyzer
return goanalysis.NewLinter(
a.Name,
a.Doc,
[]*analysis.Analyzer{a},
nil,
).WithLoadMode(goanalysis.LoadModeSyntax)
}

@ -1,190 +0,0 @@
package golinters
import (
"fmt"
"go/ast"
"go/token"
"sync"
"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 scopelintName = "scopelint"
//nolint:dupl
func NewScopelint() *goanalysis.Linter {
var mu sync.Mutex
var resIssues []goanalysis.Issue
analyzer := &analysis.Analyzer{
Name: scopelintName,
Doc: goanalysis.TheOnlyanalyzerDoc,
Run: func(pass *analysis.Pass) (any, error) {
issues := runScopeLint(pass)
if len(issues) == 0 {
return nil, nil
}
mu.Lock()
resIssues = append(resIssues, issues...)
mu.Unlock()
return nil, nil
},
}
return goanalysis.NewLinter(
scopelintName,
"Scopelint checks for unpinned variables in go programs",
[]*analysis.Analyzer{analyzer},
nil,
).WithIssuesReporter(func(*linter.Context) []goanalysis.Issue {
return resIssues
}).WithLoadMode(goanalysis.LoadModeSyntax)
}
func runScopeLint(pass *analysis.Pass) []goanalysis.Issue {
var lintIssues []result.Issue
for _, file := range pass.Files {
n := Node{
fset: pass.Fset,
DangerObjects: map[*ast.Object]int{},
UnsafeObjects: map[*ast.Object]int{},
SkipFuncs: map[*ast.FuncLit]int{},
issues: &lintIssues,
}
ast.Walk(&n, file)
}
var issues []goanalysis.Issue
for i := range lintIssues {
issues = append(issues, goanalysis.NewIssue(&lintIssues[i], pass))
}
return issues
}
// The code below is copy-pasted from https://github.com/kyoh86/scopelint 92cbe2cc9276abda0e309f52cc9e309d407f174e
// Node represents a Node being linted.
type Node struct {
fset *token.FileSet
DangerObjects map[*ast.Object]int
UnsafeObjects map[*ast.Object]int
SkipFuncs map[*ast.FuncLit]int
issues *[]result.Issue
}
// Visit method is invoked for each node encountered by Walk.
// If the result visitor w is not nil, Walk visits each of the children
// of node with the visitor w, followed by a call of w.Visit(nil).
//
//nolint:gocyclo,gocritic
func (f *Node) Visit(node ast.Node) ast.Visitor {
switch typedNode := node.(type) {
case *ast.ForStmt:
switch init := typedNode.Init.(type) {
case *ast.AssignStmt:
for _, lh := range init.Lhs {
switch tlh := lh.(type) {
case *ast.Ident:
f.UnsafeObjects[tlh.Obj] = 0
}
}
}
case *ast.RangeStmt:
// Memory variables declared in range statement
switch k := typedNode.Key.(type) {
case *ast.Ident:
f.UnsafeObjects[k.Obj] = 0
}
switch v := typedNode.Value.(type) {
case *ast.Ident:
f.UnsafeObjects[v.Obj] = 0
}
case *ast.UnaryExpr:
if typedNode.Op == token.AND {
switch ident := typedNode.X.(type) {
case *ast.Ident:
if _, unsafe := f.UnsafeObjects[ident.Obj]; unsafe {
f.errorf(ident, "Using a reference for the variable on range scope %s", formatCode(ident.Name, nil))
}
}
}
case *ast.Ident:
if _, obj := f.DangerObjects[typedNode.Obj]; obj {
// It is the naked variable in scope of range statement.
f.errorf(node, "Using the variable on range scope %s in function literal", formatCode(typedNode.Name, nil))
break
}
case *ast.CallExpr:
// Ignore func literals that'll be called immediately.
switch funcLit := typedNode.Fun.(type) {
case *ast.FuncLit:
f.SkipFuncs[funcLit] = 0
}
case *ast.FuncLit:
if _, skip := f.SkipFuncs[typedNode]; !skip {
dangers := map[*ast.Object]int{}
for d := range f.DangerObjects {
dangers[d] = 0
}
for u := range f.UnsafeObjects {
dangers[u] = 0
f.UnsafeObjects[u]++
}
return &Node{
fset: f.fset,
DangerObjects: dangers,
UnsafeObjects: f.UnsafeObjects,
SkipFuncs: f.SkipFuncs,
issues: f.issues,
}
}
case *ast.ReturnStmt:
unsafe := map[*ast.Object]int{}
for u := range f.UnsafeObjects {
if f.UnsafeObjects[u] == 0 {
continue
}
unsafe[u] = f.UnsafeObjects[u]
}
return &Node{
fset: f.fset,
DangerObjects: f.DangerObjects,
UnsafeObjects: unsafe,
SkipFuncs: f.SkipFuncs,
issues: f.issues,
}
}
return f
}
// The variadic arguments may start with link and category types,
// and must end with a format string and any arguments.
//
//nolint:interfacer
func (f *Node) errorf(n ast.Node, format string, args ...any) {
pos := f.fset.Position(n.Pos())
f.errorAtf(pos, format, args...)
}
func (f *Node) errorAtf(pos token.Position, format string, args ...any) {
*f.issues = append(*f.issues, result.Issue{
Pos: pos,
Text: fmt.Sprintf(format, args...),
FromLinter: scopelintName,
})
}

@ -1,71 +0,0 @@
package golinters
import (
"fmt"
"sync"
structcheckAPI "github.com/golangci/check/cmd/structcheck"
"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"
"github.com/golangci/golangci-lint/pkg/result"
)
const structcheckName = "structcheck"
//nolint:dupl
func NewStructcheck(settings *config.StructCheckSettings) *goanalysis.Linter {
var mu sync.Mutex
var resIssues []goanalysis.Issue
analyzer := &analysis.Analyzer{
Name: structcheckName,
Doc: goanalysis.TheOnlyanalyzerDoc,
Run: func(pass *analysis.Pass) (any, error) {
issues := runStructCheck(pass, settings)
if len(issues) == 0 {
return nil, nil
}
mu.Lock()
resIssues = append(resIssues, issues...)
mu.Unlock()
return nil, nil
},
}
return goanalysis.NewLinter(
structcheckName,
"Finds unused struct fields",
[]*analysis.Analyzer{analyzer},
nil,
).WithIssuesReporter(func(*linter.Context) []goanalysis.Issue {
return resIssues
}).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
//nolint:dupl
func runStructCheck(pass *analysis.Pass, settings *config.StructCheckSettings) []goanalysis.Issue {
prog := goanalysis.MakeFakeLoaderProgram(pass)
lintIssues := structcheckAPI.Run(prog, settings.CheckExportedFields)
if len(lintIssues) == 0 {
return nil
}
issues := make([]goanalysis.Issue, 0, len(lintIssues))
for _, i := range lintIssues {
issues = append(issues, goanalysis.NewIssue(&result.Issue{
Pos: i.Pos,
Text: fmt.Sprintf("%s is unused", formatCode(i.FieldName, nil)),
FromLinter: structcheckName,
}, pass))
}
return issues
}

@ -13,7 +13,6 @@ import (
const unconvertName = "unconvert" const unconvertName = "unconvert"
//nolint:dupl
func NewUnconvert() *goanalysis.Linter { func NewUnconvert() *goanalysis.Linter {
var mu sync.Mutex var mu sync.Mutex
var resIssues []goanalysis.Issue var resIssues []goanalysis.Issue

@ -18,14 +18,6 @@ func formatCode(code string, _ *config.Config) string {
return fmt.Sprintf("`%s`", code) return fmt.Sprintf("`%s`", code)
} }
func formatCodeBlock(code string, _ *config.Config) string {
if strings.Contains(code, "`") {
return code // TODO: properly escape or remove
}
return fmt.Sprintf("```\n%s\n```", code)
}
func getFileNames(pass *analysis.Pass) []string { func getFileNames(pass *analysis.Pass) []string {
var fileNames []string var fileNames []string
for _, f := range pass.Files { for _, f := range pass.Files {

@ -1,72 +0,0 @@
package golinters
import (
"fmt"
"sync"
varcheckAPI "github.com/golangci/check/cmd/varcheck"
"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"
"github.com/golangci/golangci-lint/pkg/result"
)
const varcheckName = "varcheck"
func NewVarcheck(settings *config.VarCheckSettings) *goanalysis.Linter {
var mu sync.Mutex
var resIssues []goanalysis.Issue
analyzer := &analysis.Analyzer{
Name: varcheckName,
Doc: goanalysis.TheOnlyanalyzerDoc,
Run: goanalysis.DummyRun,
}
return goanalysis.NewLinter(
varcheckName,
"Finds unused global variables and constants",
[]*analysis.Analyzer{analyzer},
nil,
).WithContextSetter(func(_ *linter.Context) {
analyzer.Run = func(pass *analysis.Pass) (any, error) {
issues := runVarCheck(pass, settings)
if len(issues) == 0 {
return nil, nil
}
mu.Lock()
resIssues = append(resIssues, issues...)
mu.Unlock()
return nil, nil
}
}).WithIssuesReporter(func(*linter.Context) []goanalysis.Issue {
return resIssues
}).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
//nolint:dupl
func runVarCheck(pass *analysis.Pass, settings *config.VarCheckSettings) []goanalysis.Issue {
prog := goanalysis.MakeFakeLoaderProgram(pass)
lintIssues := varcheckAPI.Run(prog, settings.CheckExportedFields)
if len(lintIssues) == 0 {
return nil
}
issues := make([]goanalysis.Issue, 0, len(lintIssues))
for _, i := range lintIssues {
issues = append(issues, goanalysis.NewIssue(&result.Issue{
Pos: i.Pos,
Text: fmt.Sprintf("%s is unused", formatCode(i.VarName, nil)),
FromLinter: varcheckName,
}, pass))
}
return issues
}

@ -3,6 +3,7 @@ package linter
import ( import (
"context" "context"
"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/result" "github.com/golangci/golangci-lint/pkg/result"
) )
@ -26,6 +27,20 @@ func NewNoop(l Linter, reason string) Noop {
} }
} }
func NewNoopDeprecated(name string, cfg *config.Config) Noop {
noop := Noop{
name: name,
desc: "Deprecated",
reason: "This linter is fully inactivated: it will not produce any reports.",
}
if cfg.InternalCmdTest {
noop.reason = ""
}
return noop
}
func (n Noop) Run(_ context.Context, lintCtx *Context) ([]result.Issue, error) { func (n Noop) Run(_ context.Context, lintCtx *Context) ([]result.Issue, error) {
if n.reason != "" { if n.reason != "" {
lintCtx.Log.Warnf("%s: %s", n.name, n.reason) lintCtx.Log.Warnf("%s: %s", n.name, n.reason)

@ -77,7 +77,7 @@ func (b LinterBuilder) Build(cfg *config.Config) []*linter.Config {
WithPresets(linter.PresetFormatting, linter.PresetStyle). WithPresets(linter.PresetFormatting, linter.PresetStyle).
WithURL("https://gitlab.com/bosi/decorder"), WithURL("https://gitlab.com/bosi/decorder"),
linter.NewConfig(golinters.NewDeadcode()). linter.NewConfig(linter.NewNoopDeprecated("deadcode", cfg)).
WithSince("v1.0.0"). WithSince("v1.0.0").
WithLoadForGoAnalysis(). WithLoadForGoAnalysis().
WithPresets(linter.PresetUnused). WithPresets(linter.PresetUnused).
@ -148,12 +148,12 @@ func (b LinterBuilder) Build(cfg *config.Config) []*linter.Config {
WithLoadForGoAnalysis(). WithLoadForGoAnalysis().
WithURL("https://github.com/nishanths/exhaustive"), WithURL("https://github.com/nishanths/exhaustive"),
linter.NewConfig(golinters.NewExhaustiveStruct(&cfg.LintersSettings.ExhaustiveStruct)). linter.NewConfig(linter.NewNoopDeprecated("exhaustivestruct", cfg)).
WithSince("v1.32.0"). WithSince("v1.32.0").
WithPresets(linter.PresetStyle, linter.PresetTest). WithPresets(linter.PresetStyle, linter.PresetTest).
WithLoadForGoAnalysis(). WithLoadForGoAnalysis().
WithURL("https://github.com/mbilski/exhaustivestruct"). WithURL("https://github.com/mbilski/exhaustivestruct").
Deprecated("The owner seems to have abandoned the linter.", "v1.46.0", "exhaustruct"), Deprecated("The repository of the linter has been deprecated by the owner.", "v1.46.0", "exhaustruct"),
linter.NewConfig(golinters.NewExhaustruct(&cfg.LintersSettings.Exhaustruct)). linter.NewConfig(golinters.NewExhaustruct(&cfg.LintersSettings.Exhaustruct)).
WithSince("v1.46.0"). WithSince("v1.46.0").
@ -280,7 +280,7 @@ func (b LinterBuilder) Build(cfg *config.Config) []*linter.Config {
WithAutoFix(). WithAutoFix().
WithURL("https://pkg.go.dev/golang.org/x/tools/cmd/goimports"), WithURL("https://pkg.go.dev/golang.org/x/tools/cmd/goimports"),
linter.NewConfig(golinters.NewGolint(&cfg.LintersSettings.Golint)). linter.NewConfig(linter.NewNoopDeprecated("golint", cfg)).
WithSince("v1.0.0"). WithSince("v1.0.0").
WithLoadForGoAnalysis(). WithLoadForGoAnalysis().
WithPresets(linter.PresetStyle). WithPresets(linter.PresetStyle).
@ -341,7 +341,7 @@ func (b LinterBuilder) Build(cfg *config.Config) []*linter.Config {
WithPresets(linter.PresetStyle). WithPresets(linter.PresetStyle).
WithURL("https://github.com/leonklingele/grouper"), WithURL("https://github.com/leonklingele/grouper"),
linter.NewConfig(golinters.NewIfshort(&cfg.LintersSettings.Ifshort)). linter.NewConfig(linter.NewNoopDeprecated("ifshort", cfg)).
WithSince("v1.36.0"). WithSince("v1.36.0").
WithPresets(linter.PresetStyle). WithPresets(linter.PresetStyle).
WithURL("https://github.com/esimonov/ifshort"). WithURL("https://github.com/esimonov/ifshort").
@ -369,7 +369,7 @@ func (b LinterBuilder) Build(cfg *config.Config) []*linter.Config {
WithPresets(linter.PresetStyle). WithPresets(linter.PresetStyle).
WithURL("https://github.com/sashamelentyev/interfacebloat"), WithURL("https://github.com/sashamelentyev/interfacebloat"),
linter.NewConfig(golinters.NewInterfacer()). linter.NewConfig(linter.NewNoopDeprecated("interfacer", cfg)).
WithSince("v1.0.0"). WithSince("v1.0.0").
WithLoadForGoAnalysis(). WithLoadForGoAnalysis().
WithPresets(linter.PresetStyle). WithPresets(linter.PresetStyle).
@ -409,7 +409,7 @@ func (b LinterBuilder) Build(cfg *config.Config) []*linter.Config {
WithLoadForGoAnalysis(). WithLoadForGoAnalysis().
WithURL("https://github.com/ashanbrown/makezero"), WithURL("https://github.com/ashanbrown/makezero"),
linter.NewConfig(golinters.NewMaligned(&cfg.LintersSettings.Maligned)). linter.NewConfig(linter.NewNoopDeprecated("maligned", cfg)).
WithSince("v1.0.0"). WithSince("v1.0.0").
WithLoadForGoAnalysis(). WithLoadForGoAnalysis().
WithPresets(linter.PresetPerformance). WithPresets(linter.PresetPerformance).
@ -473,7 +473,7 @@ func (b LinterBuilder) Build(cfg *config.Config) []*linter.Config {
WithPresets(linter.PresetStyle). WithPresets(linter.PresetStyle).
WithURL("https://github.com/firefart/nonamedreturns"), WithURL("https://github.com/firefart/nonamedreturns"),
linter.NewConfig(golinters.NewNoSnakeCase()). linter.NewConfig(linter.NewNoopDeprecated("nosnakecase", cfg)).
WithSince("v1.47.0"). WithSince("v1.47.0").
WithPresets(linter.PresetStyle). WithPresets(linter.PresetStyle).
WithURL("https://github.com/sivchari/nosnakecase"). WithURL("https://github.com/sivchari/nosnakecase").
@ -542,7 +542,7 @@ func (b LinterBuilder) Build(cfg *config.Config) []*linter.Config {
WithPresets(linter.PresetStyle, linter.PresetFormatting). WithPresets(linter.PresetStyle, linter.PresetFormatting).
WithURL("https://github.com/go-simpler/sloglint"), WithURL("https://github.com/go-simpler/sloglint"),
linter.NewConfig(golinters.NewScopelint()). linter.NewConfig(linter.NewNoopDeprecated("scopelint", cfg)).
WithSince("v1.12.0"). WithSince("v1.12.0").
WithPresets(linter.PresetBugs). WithPresets(linter.PresetBugs).
WithURL("https://github.com/kyoh86/scopelint"). WithURL("https://github.com/kyoh86/scopelint").
@ -568,7 +568,7 @@ func (b LinterBuilder) Build(cfg *config.Config) []*linter.Config {
WithAlternativeNames(megacheckName). WithAlternativeNames(megacheckName).
WithURL("https://staticcheck.io/"), WithURL("https://staticcheck.io/"),
linter.NewConfig(golinters.NewStructcheck(&cfg.LintersSettings.Structcheck)). linter.NewConfig(linter.NewNoopDeprecated("structcheck", cfg)).
WithSince("v1.0.0"). WithSince("v1.0.0").
WithLoadForGoAnalysis(). WithLoadForGoAnalysis().
WithPresets(linter.PresetUnused). WithPresets(linter.PresetUnused).
@ -661,7 +661,7 @@ func (b LinterBuilder) Build(cfg *config.Config) []*linter.Config {
WithPresets(linter.PresetStyle). WithPresets(linter.PresetStyle).
WithURL("https://github.com/sashamelentyev/usestdlibvars"), WithURL("https://github.com/sashamelentyev/usestdlibvars"),
linter.NewConfig(golinters.NewVarcheck(&cfg.LintersSettings.Varcheck)). linter.NewConfig(linter.NewNoopDeprecated("varcheck", cfg)).
WithSince("v1.0.0"). WithSince("v1.0.0").
WithLoadForGoAnalysis(). WithLoadForGoAnalysis().
WithPresets(linter.PresetUnused). WithPresets(linter.PresetUnused).

@ -1,5 +0,0 @@
linters-settings:
exhaustivestruct:
struct-patterns:
- '*.ExhaustiveStructCustom'
- '*.ExhaustiveStructCustom2'

@ -1,21 +0,0 @@
//golangcitest:args -Edeadcode --internal-cmd-test
package testdata
var y int
var unused int // want "`unused` is unused"
func f(x int) {
}
func g(x int) { // want "`g` is unused"
}
func H(x int) {
}
func init() {
f(y)
}
var _ int

@ -1,46 +0,0 @@
//golangcitest:args -Eexhaustivestruct --internal-cmd-test
package testdata
import "time"
type ExhaustiveStruct struct {
A string
B int
c bool // private field inside the same package are not ignored
D float64
E time.Time
}
func exhaustiveStruct() {
// pass
_ = ExhaustiveStruct{
A: "a",
B: 0,
c: false,
D: 1.0,
E: time.Now(),
}
// failPrivate
_ = ExhaustiveStruct{ // want "c is missing in ExhaustiveStruct"
A: "a",
B: 0,
D: 1.0,
E: time.Now(),
}
// fail
_ = ExhaustiveStruct{ // want "B is missing in ExhaustiveStruct"
A: "a",
c: false,
D: 1.0,
E: time.Now(),
}
// failMultiple
_ = ExhaustiveStruct{ // want "B, D are missing in ExhaustiveStruct"
A: "a",
c: false,
E: time.Now(),
}
}

@ -1,129 +0,0 @@
//golangcitest:args -Eexhaustivestruct --internal-cmd-test
//golangcitest:config_path testdata/configs/exhaustivestruct.yml
package testdata
import "time"
type ExhaustiveStructCustom struct {
A string
B int
c bool // private field inside the same package are not ignored
D float64
E time.Time
}
func exhaustiveStructCustom() {
// pass
_ = ExhaustiveStructCustom{
A: "a",
B: 0,
c: false,
D: 1.0,
E: time.Now(),
}
// fail
_ = ExhaustiveStructCustom{ // want "B is missing in ExhaustiveStructCustom"
A: "a",
c: false,
D: 1.0,
E: time.Now(),
}
// failMultiple
_ = ExhaustiveStructCustom{ // want "B, D are missing in ExhaustiveStructCustom"
A: "a",
c: false,
E: time.Now(),
}
// failPrivate
_ = ExhaustiveStructCustom{ // want "c is missing in ExhaustiveStructCustom"
A: "a",
B: 0,
D: 1.0,
E: time.Now(),
}
}
type ExhaustiveStructCustom1 struct {
A string
B int
c bool // private field inside the same package are not ignored
D float64
E time.Time
}
func exhaustiveStructCustom1() {
_ = ExhaustiveStructCustom1{
A: "a",
B: 0,
c: false,
D: 1.0,
E: time.Now(),
}
_ = ExhaustiveStructCustom1{
A: "a",
c: false,
D: 1.0,
E: time.Now(),
}
_ = ExhaustiveStructCustom1{
A: "a",
c: false,
E: time.Now(),
}
_ = ExhaustiveStructCustom1{
A: "a",
B: 0,
D: 1.0,
E: time.Now(),
}
}
type ExhaustiveStructCustom2 struct {
A string
B int
c bool // private field inside the same package are not ignored
D float64
E time.Time
}
func exhaustiveStructCustom2() {
// pass
_ = ExhaustiveStructCustom2{
A: "a",
B: 0,
c: false,
D: 1.0,
E: time.Now(),
}
// fail
_ = ExhaustiveStructCustom2{ // want "B is missing in ExhaustiveStructCustom2"
A: "a",
c: false,
D: 1.0,
E: time.Now(),
}
// failMultiple
_ = ExhaustiveStructCustom2{ // want "B, D are missing in ExhaustiveStructCustom2"
A: "a",
c: false,
E: time.Now(),
}
// failPrivate
_ = ExhaustiveStructCustom2{ // want "c is missing in ExhaustiveStructCustom2"
A: "a",
B: 0,
D: 1.0,
E: time.Now(),
}
}

@ -1,22 +0,0 @@
//golangcitest:args -Egolint --internal-cmd-test
package testdata
var Go_lint string // want "don't use underscores in Go names; var `Go_lint` should be `GoLint`"
func ExportedFuncWithNoComment() {
}
var ExportedVarWithNoComment string
type ExportedStructWithNoComment struct{}
type ExportedInterfaceWithNoComment interface{}
// Bad comment
func ExportedFuncWithBadComment() {}
type GolintTest struct{}
func (receiver1 GolintTest) A() {}
func (receiver2 GolintTest) B() {} // want "receiver name receiver2 should be consistent with previous receiver name receiver1 for GolintTest"

@ -1,13 +0,0 @@
//go:build !windows
//golangcitest:args -Eifshort --internal-cmd-test
package testdata
func DontUseShortSyntaxWhenPossible() {
getValue := func() interface{} { return nil }
v := getValue() // want "variable 'v' is only used in the if-statement .*"
if v != nil {
return
}
}

@ -1,8 +0,0 @@
//golangcitest:args -Einterfacer --internal-cmd-test
package testdata
import "io"
func InterfacerCheck(f io.ReadCloser) { // want "`f` can be `io.Closer`"
f.Close()
}

@ -1,8 +0,0 @@
//golangcitest:args -Emaligned --internal-cmd-test
package testdata
type BadAlignedStruct struct { // want "struct of size 24 bytes could be of size 16 bytes"
B bool
I int
B2 bool
}

@ -1,149 +0,0 @@
//golangcitest:args -Enosnakecase --internal-cmd-test
package testdata
import (
_ "fmt"
f_m_t "fmt" // want "f_m_t contains underscore. You should use mixedCap or MixedCap."
)
// global variable name with underscore.
var v_v = 0 // want "v_v contains underscore. You should use mixedCap or MixedCap."
// global constant name with underscore.
const c_c = 0 // want "c_c contains underscore. You should use mixedCap or MixedCap."
// struct name with underscore.
type S_a struct { // want "S_a contains underscore. You should use mixedCap or MixedCap."
fi int
}
// non-exported struct field name with underscore.
type Sa struct {
fi_a int // // want "fi_a contains underscore. You should use mixedCap or MixedCap."
}
// function as struct field, with parameter name with underscore.
type Sb struct {
fib func(p_a int) // want "p_a contains underscore. You should use mixedCap or MixedCap."
}
// exported struct field with underscore.
type Sc struct {
Fi_A int // want "Fi_A contains underscore. You should use mixedCap or MixedCap."
}
// function as struct field, with return name with underscore.
type Sd struct {
fib func(p int) (r_a int) // want "r_a contains underscore. You should use mixedCap or MixedCap."
}
// interface name with underscore.
type I_a interface { // want "I_a contains underscore. You should use mixedCap or MixedCap."
fn(p int)
}
// interface with parameter name with underscore.
type Ia interface {
fn(p_a int) // want "p_a contains underscore. You should use mixedCap or MixedCap."
}
// interface with parameter name with underscore.
type Ib interface {
Fn(p_a int) // want "p_a contains underscore. You should use mixedCap or MixedCap."
}
// function as struct field, with return name with underscore.
type Ic interface {
Fn_a() // want "Fn_a contains underscore. You should use mixedCap or MixedCap."
}
// interface with return name with underscore.
type Id interface {
Fn() (r_a int) // want "r_a contains underscore. You should use mixedCap or MixedCap."
}
// function name with underscore.
func f_a() {} // want "f_a contains underscore. You should use mixedCap or MixedCap."
// function's parameter name with underscore.
func fb(p_a int) {} // want "p_a contains underscore. You should use mixedCap or MixedCap."
// named return with underscore.
func fc() (r_b int) { // want "r_b contains underscore. You should use mixedCap or MixedCap."
return 0
}
// local variable (short declaration) with underscore.
func fd(p int) int {
v_b := p * 2 // want "v_b contains underscore. You should use mixedCap or MixedCap."
return v_b // want "v_b contains underscore. You should use mixedCap or MixedCap."
}
// local constant with underscore.
func fe(p int) int {
const v_b = 2 // want "v_b contains underscore. You should use mixedCap or MixedCap."
return v_b * p // want "v_b contains underscore. You should use mixedCap or MixedCap."
}
// local variable with underscore.
func ff(p int) int {
var v_b = 2 // want "v_b contains underscore. You should use mixedCap or MixedCap."
return v_b * p // want "v_b contains underscore. You should use mixedCap or MixedCap."
}
// inner function, parameter name with underscore.
func fg() {
fgl := func(p_a int) {} // want "p_a contains underscore. You should use mixedCap or MixedCap."
fgl(1)
}
type Foo struct{}
// method name with underscore.
func (f Foo) f_a() {} // want "f_a contains underscore. You should use mixedCap or MixedCap."
// method's parameter name with underscore.
func (f Foo) fb(p_a int) {} // want "p_a contains underscore. You should use mixedCap or MixedCap."
// named return with underscore.
func (f Foo) fc() (r_b int) { return 0 } // want "r_b contains underscore. You should use mixedCap or MixedCap."
// local variable (short declaration) with underscore.
func (f Foo) fd(p int) int {
v_b := p * 2 // want "v_b contains underscore. You should use mixedCap or MixedCap."
return v_b // want "v_b contains underscore. You should use mixedCap or MixedCap."
}
// local constant with underscore.
func (f Foo) fe(p int) int {
const v_b = 2 // want "v_b contains underscore. You should use mixedCap or MixedCap."
return v_b * p // want "v_b contains underscore. You should use mixedCap or MixedCap."
}
// local variable with underscore.
func (f Foo) ff(p int) int {
var v_b = 2 // want "v_b contains underscore. You should use mixedCap or MixedCap."
return v_b * p // want "v_b contains underscore. You should use mixedCap or MixedCap."
}
func fna(a, p_a int) {} // want "p_a contains underscore. You should use mixedCap or MixedCap."
func fna1(a string, p_a int) {} // want "p_a contains underscore. You should use mixedCap or MixedCap."
func fnb(a, b, p_a int) {} // want "p_a contains underscore. You should use mixedCap or MixedCap."
func fnb1(a, b string, p_a int) {} // want "p_a contains underscore. You should use mixedCap or MixedCap."
func fnd(
p_a int, // want "p_a contains underscore. You should use mixedCap or MixedCap."
p_b int, // want "p_b contains underscore. You should use mixedCap or MixedCap."
p_c int, // want "p_c contains underscore. You should use mixedCap or MixedCap."
) {
f_m_t.Println("") // want "f_m_t contains underscore. You should use mixedCap or MixedCap."
}

@ -1,17 +0,0 @@
//golangcitest:args -Escopelint --internal-cmd-test
package testdata
import "fmt"
func ScopelintTest() {
values := []string{"a", "b", "c"}
var funcs []func()
for _, val := range values {
funcs = append(funcs, func() {
fmt.Println(val) // want "Using the variable on range scope `val` in function literal"
})
}
for _, f := range funcs {
f()
}
}

@ -1,6 +0,0 @@
//golangcitest:args -Estructcheck
package testdata
type t struct {
unusedField int // want "`unusedField` is unused"
}

@ -1,4 +0,0 @@
//golangcitest:args -Evarcheck --internal-cmd-test
package testdata
var v string // want "`v` is unused"