Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revive config apparently broken in 1.56.0 #4353

Closed
5 tasks done
flimzy opened this issue Feb 7, 2024 · 14 comments · Fixed by #4355
Closed
5 tasks done

Revive config apparently broken in 1.56.0 #4353

flimzy opened this issue Feb 7, 2024 · 14 comments · Fixed by #4355
Labels
bug Something isn't working dependencies Relates to an upstream dependency

Comments

@flimzy
Copy link

flimzy commented Feb 7, 2024

Welcome

Description of the problem

After updating to golangci-lint 1.56.0, the linter fails to start with the following output:

$ golangci-lint run ./...
WARN [runner] Can't run linter goanalysis_metalinter: the_only_name: cannot find rule: enforce-repeated-arg-type-style 
ERRO Running error: can't run linter goanalysis_metalinter
the_only_name: cannot find rule: enforce-repeated-arg-type-style 

Either disabling the revive linter, or configuring it with enable-all-rules = false allows the linter to run successfully.

I have added the relevant configuration section to disable the new revive rule:

[[linters-settings.revive.rules]]
name = "enforce-repeated-arg-type-style"
disabled = true                          # Duplicate of gosimple

But it seems to have no effect. Perhaps I've done it incorrectly, and this isn't actually a bug.

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 1.56.0 built with go1.22.0 from 1a00b409 on 2024-02-07T14:39:45Z

Configuration

[run]
timeout = "180s"
allow-parallel-runners = true

[output]
format = "colored-line-number"

[linters]
disable-all = true
enable = [
    # Detect unused code
    "ineffassign",
    "unused",
    "unparam",

    # Styling/formatting
    "dupword",
    "errname",
    "gci",        # Handles import groups/ordering
    "gofumpt",
    "misspell",
    "nolintlint",
    "nestif",

    # Code simplifications
    "unconvert",
    "gosimple",

    # Likely bugs
    "bodyclose",
    "containedctx",
    "depguard",
    "errcheck",
    "errchkjson",
    "errorlint",
    "forbidigo",
    "gochecknoglobals",
    "gochecknoinits",
    "gocritic",         # A general-purpose linter, see specific configuration below.
    "gosec",
    "ineffassign",
    "noctx",
    "revive",
    "rowserrcheck",     # Checks whether Rows.Err of rows is checked successfully.
    "sqlclosecheck",    # Checks that sql.Rows, sql.Stmt, sqlx.NamedStmt, pgx.Query are closed.
    "staticcheck",
    "thelper",
    "tparallel",

    # Performance related
    "prealloc",

    # Misc
    "govet",
    # "dupl", # Temporarily disabled
]

[issues]
exclude-use-default = false
max-same-issues = 10
new-from-rev = "23efba26bf876f18b4e4c5e46b8c8535dd5ea490"

[linters-settings.gci]
sections = ["standard", "default", "prefix(github.com/float-health/float-core)"]
skip-generated = false
custom-order = true

[linters-settings.rowserrcheck]
packages = ["github.com/jmoiron/sqlx"]

[linters-settings.nolintlint]
require-explanation = true
require-specific = true

[linters-settings.depguard.rules.main]

[[linters-settings.depguard.rules.main.deny]]
pkg = "github.com/pkg/errors"
desc = "use github.com/float-app/float-core/internal/errors"

[[linters-settings.depguard.rules.main.deny]]
pkg = "errors"
desc = "use github.com/float-app/float-core/internal/errors"

[[linters-settings.forbidigo.forbid]]
p = "^fmt\\.(Fatal|Panic)"
msg = "fmt.Fatal* and fmt.Panic* introduce tight coupling between control flow and output"

[[linters-settings.forbidigo.forbid]]
p = "^fmt\\.Print"
msg = "use slog.Info"

[[linters-settings.forbidigo.forbid]]
p = "^fmt\\.Errorf"
msg = "use github.com/float-health/float-core/internal/errors.Errorf"

[[linters-settings.forbidigo.forbid]]
p = "^log\\.Print"
msg = "use slog.Info"

[linters-settings.gocritic]
enabled-checks = [
    # To see all available checks, run `GL_DEBUG=gocritic golangci-lint run`

    ## Unused code
    "commentedOutCode",   # Detects commented-out code inside function bodies
    "commentedOutImport", # Detects commented-out imports

    # Code formatting & style
    "captLocal",
    "deprecatedComment",
    "docStub",
    "dupImport",
    "elseif",
    "emptyDecl",
    "emptyStringTest",
    "exposedSyncMutex",
    "ifElseChain",
    "preferFilepathJoin",
    "ptrToRefParam",
    "typeAssertChain",
    "whyNoLint",

    # Code simplifications
    "appendCombine",
    "assignOp",
    "boolExprSimplify",
    "deferUnlambda",
    "sloppyTypeAssert",
    "unnecessaryDefer",
    "emptyFallthrough",
    "methodExprCall",
    "nestingReduce",
    "newDeref",
    "paramTypeCombine",
    "preferFprint",
    "redundantSprint",
    "regexpSimplify",
    "singleCaseSwitch",
    "sloppyLen",
    "stringConcatSimplify",
    "stringsCompare",
    "switchTrue",
    "timeCmpSimplify",
    "typeSwitchVar",
    "typeUnparen",
    "underef",
    "unlambda",
    "unnecessaryBlock",
    "unslice",
    "valSwap",
    "wrapperFunc",

    ## Likely bugs
    "argOrder",              # Detects suspicious arguments order
    "badCall",               # Detects suspicious function calls
    "badCond",               # Detects suspicious condition expressions
    "badLock",               # Detects suspicious mutex lock/unlock operations
    "badRegexp",             # Detects suspicious regexp patterns
    "badSorting",            # Detects bad usage of sort package
    "caseOrder",             # Detects erroneous case order inside switch statements
    "deferInLoop",           # Detects loops inside functions that use defer
    "dupArg",                # Detects suspicious duplicated arguments
    "dupCase",               # Detects duplicated case clauses inside switch or select statements
    "dupSubExpr",            # Detects suspicious duplicated sub-expressions
    "dynamicFmtString",      # Detects suspicious formatting strings usage
    "evalOrder",             # Detects unwanted dependencies on the evaluation order
    "exitAfterDefer",        # Detects calls to exit/fatal inside functions that use defer
    "externalErrorReassign", # Detects suspicious reassigment of error from another package
    "flagDeref",             # Detects immediate dereferencing of flag package pointers
    "flagName",              # Detects suspicious flag names
    "initClause",            # Detects non-assignment statements inside if/switch init clause
    "mapKey",                # Detects suspicious map literal keys
    "nilValReturn",          # Detects return statements those results evaluate to nil
    "offBy1",                # Detects various off-by-one kind of errors
    "regexpMust",            # Detects regexp.Compile* that can be replaced with regexp.MustCompile*
    "regexpPattern",         # Detects suspicious regexp patterns
    "returnAfterHttpError",  # Detects suspicious http.Error call without following return
    "sortSlice",             # Detects suspicious sort.Slice calls
    "sqlQuery",              # Detects issue in Query() and Exec() calls
    "truncateCmp",           # Detects potential truncation issues when comparing ints of different sizes
    "uncheckedInlineErr",    # Detects unchecked errors in if statements
    "weakCond",              # Detects conditions that are unsafe due to not being exhaustive.

    ## Performance
    "equalFold",          # Detects unoptimal strings/bytes case-insensitive comparison
    "indexAlloc",         # Detects strings.Index calls that may cause unwanted allocs
    "preferDecodeRune",   # Detects expressions like []rune(s)[0] that may cause unwanted rune slice allocation
    "preferStringWriter", # Detects w.Write or io.WriteString calls which can be replaced with w.WriteString
    "preferWriteByte",    # Detects WriteRune calls with rune literal argument that is single byte and reports to use WriteByte instead
    "rangeExprCopy",      # Detects expensive copies of for loop range expressions
    "sliceClear",         # Detects slice clear loops, suggests an idiom that is recognized by the Go compiler
    "stringXbytes",       # Detects redundant conversions between string and []byte
]

[[issues.exclude-rules]]
source = "defer .*\\.(Close|Rollback)\\(\\)$"
linters = ["errcheck"]

[[issues.exclude-rules]]
path = "_test.go"
text = "add-constant: "
linters = ["revive"]

[[issues.exclude-rules]]
source = "strconv\\.(Parse|Format).*"
text = "add-constant: "
linters = ["revive"]

[[issues.exclude-rules]]
source = "(query|queries) :="
linters = ["dupword"]

[linters-settings.gosec]
excludes = [
    "G104", # Duplicate of errcheck
    "G307", # Duplicate of errcheck
    "G601", # Obsoleted by Go 1.22
]


[linters-settings.revive]
max-open-files = 2_048
ignore-generated-header = true
severity = "error"
# Enable all revive rules, except those we disable explicitly below.
# The full list of available rules can be found at
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md
enable-all-rules = true
confidence = 0.1

# warns for things like `x, _ := y.(error)`, which seems pretty explictly intentional to me
[[linters-settings.revive.rules]]
name = "unchecked-type-assertion"
disabled = true

# Suggests using constant for magic numbers and string literals.
[[linters-settings.revive.rules]]
name = "add-constant"
disabled = false

[[linters-settings.revive.rules.arguments]]
maxLitCount = "3"
allowStrs = '"","_id","tagId","status","frequency","sent","type"'
allowInts = "0,1,2"
allowFloats = "0.0,0.,1.0,1.,2.0,2."

# Warns when a function receives more parameters than the maximum set by the rule's configuration. Enforcing a maximum number of parameters helps to keep the code readable and maintainable.
[[linters-settings.revive.rules]]
name = "argument-limit"
disabled = false
arguments = [10]

# Check for commonly mistaken usages of the sync/atomic package.
[[linters-settings.revive.rules]]
name = "atomic"
disabled = false

# Checks given banned characters in identifiers(func, var, const). Comments are not checked.
[[linters-settings.revive.rules]]
name = "banned-characters"
disabled = true

# Warns on bare (a.k.a. naked) returns.
[[linters-settings.revive.rules]]
name = "bare-return"
disabled = false

# Blank import should be only in a main or test package, or have a comment justifying it.
[[linters-settings.revive.rules]]
name = "blank-imports"
disabled = false

# Using Boolean literals (true, false) in logic expressions may make the code less readable. This rule suggests removing Boolean literals from logic expressions.
[[linters-settings.revive.rules]]
name = "bool-literal-in-expr"
disabled = true               # duplicate of gosimple, which provides better suggestions

# Explicitly invoking the garbage collector is, except for specific uses in benchmarking, very dubious.
[[linters-settings.revive.rules]]
name = "call-to-gc"
disabled = false

# Cognitive complexity is a measure of how hard code is to understand. While cyclomatic complexity is good to measure "testability" of the code, cognitive complexity aims to provide a more precise measure of the difficulty of understanding the code. Enforcing a maximum complexity per function helps to keep code readable and maintainable.
[[linters-settings.revive.rules]]
name = "cognitive-complexity"
disabled = true

# Spots comments with improper spacing.
[[linters-settings.revive.rules]]
name = "comment-spacings"
disabled = true                         # gofumpt should already handle this for us
arguments = ["mypragma", "otherpragma"]

# Methods or fields of struct that have names different only by capitalization could be confusing.
[[linters-settings.revive.rules]]
name = "confusing-naming"
disabled = true

# Function or methods that return multiple, no named, values of the same type could induce error.
[[linters-settings.revive.rules]]
name = "confusing-results"
disabled = false

# The rule spots logical expressions that evaluate always to the same value.
[[linters-settings.revive.rules]]
name = "constant-logical-expr"
disabled = false

# By convention, context.Context should be the first parameter of a function. This rule spots function declarations that do not follow the convention.
[[linters-settings.revive.rules]]
name = "context-as-argument"
disabled = false

# Basic types should not be used as a key in context.WithValue.
[[linters-settings.revive.rules]]
name = "context-keys-type"
disabled = false

# Cyclomatic complexity is a measure of code complexity. Enforcing a maximum complexity per function helps to keep code readable and maintainable.
[[linters-settings.revive.rules]]
name = "cyclomatic"
disabled = true
arguments = [10]

# This rule spots potential dataraces caused by go-routines capturing (by-reference) particular identifiers of the function from which go-routines are created. The rule is able to spot two of such cases: go-routines capturing named return values, and capturing for-range values.
[[linters-settings.revive.rules]]
name = "datarace"
disabled = false

# Packages exposing functions that can stop program execution by exiting are hard to reuse. This rule looks for program exits in functions other than main() or init().
[[linters-settings.revive.rules]]
name = "deep-exit"
disabled = true    # temporarily disabled to allow revert

# This rule warns on some common mistakes when using defer statement.
[[linters-settings.revive.rules]]
name = "defer"
disabled = false

# Importing with . makes the programs much harder to understand because it is unclear whether names belong to the current package or to an imported package.
[[linters-settings.revive.rules]]
name = "dot-imports"
disabled = false

# It is possible to unintentionally import the same package twice. This rule looks for packages that are imported two or more times.
[[linters-settings.revive.rules]]
name = "duplicated-imports"
disabled = true             # Duplicate of gocritic's dupImport

# In Go it is idiomatic to minimize nesting statements, a typical example is to avoid if-then-else constructions.
[[linters-settings.revive.rules]]
name = "early-return"
disabled = false

# Empty blocks make code less readable and could be a symptom of a bug or unfinished refactoring.
[[linters-settings.revive.rules]]
name = "empty-block"
disabled = false

# Sometimes gofmt is not enough to enforce a common formatting of a code-base; this rule warns when there are heading or trailing newlines in code blocks.
[[linters-settings.revive.rules]]
name = "empty-lines"
disabled = true      # duplicate of gofumpt

# By convention, for the sake of readability, variables of type error must be named with the prefix err.
[[linters-settings.revive.rules]]
name = "error-naming"
disabled = false

# By convention, for the sake of readability, the errors should be last in the list of returned values by a function.
[[linters-settings.revive.rules]]
name = "error-return"
disabled = false

# By convention, for better readability, error messages should not be capitalized or end with punctuation or a newline.
[[linters-settings.revive.rules]]
name = "error-strings"
disabled = false

# It is possible to get a simpler program by replacing errors.New(fmt.Sprintf()) with fmt.Errorf(). This rule spots that kind of simplification opportunities.
[[linters-settings.revive.rules]]
name = "errorf"
disabled = false

# Exported function and methods should have comments. This warns on undocumented exported functions and methods.
[[linters-settings.revive.rules]]
name = "exported"
disabled = true                                # Temporarily disabled, as everything is in the `main` package now; should be re-enabled after moving to float-core when we start moving to separate packages
arguments = ["sayRepetitiveInsteadOfStutters"]

# This rule helps to enforce a common header for all source files in a project by spotting those files that do not have the specified header.
[[linters-settings.revive.rules]]
name = "file-header"
disabled = true      # No standard file header for this project

# If a function controls the flow of another by passing it information on what to do, both functions are said to be control-coupled. Coupling among functions must be minimized for better maintainability of the code. This rule warns on boolean parameters that create a control coupling.
[[linters-settings.revive.rules]]
name = "flag-parameter"
disabled = true

# Functions returning too many results can be hard to understand/use.
[[linters-settings.revive.rules]]
name = "function-result-limit"
disabled = true
arguments = [3]

# Functions too long (with many statements and/or lines) can be hard to understand.
[[linters-settings.revive.rules]]
name = "function-length"
disabled = true
arguments = [25, 0]

# Typically, functions with names prefixed with Get are supposed to return a value.
[[linters-settings.revive.rules]]
name = "get-return"
disabled = true     # too many false positives from endpoint handlers.

# an if-then-else conditional with identical implementations in both branches is an error.
[[linters-settings.revive.rules]]
name = "identical-branches"
disabled = false

# Checking if an error is nil to just after return the error or nil is redundant.
[[linters-settings.revive.rules]]
name = "if-return"
disabled = false

# By convention, for better readability, incrementing an integer variable by 1 is recommended to be done using the ++ operator. This rule spots expressions like i += 1 and i -= 1 and proposes to change them into i++ and i--.
[[linters-settings.revive.rules]]
name = "increment-decrement"
disabled = false

# To improve the readability of code, it is recommended to reduce the indentation as much as possible. This rule highlights redundant else-blocks that can be eliminated from the code.
[[linters-settings.revive.rules]]
name = "indent-error-flow"
disabled = false

# Warns when importing black-listed packages.
[[linters-settings.revive.rules]]
name = "imports-blacklist"
disabled = true            # duplicate of forbidigo
# arguments = [
#     # Add black-listed imports here
# ]

# In Go it is possible to declare identifiers (packages, structs, interfaces, parameters, receivers, variables, constants...) that conflict with the name of an imported package. This rule spots identifiers that shadow an import.
[[linters-settings.revive.rules]]
name = "import-shadowing"
disabled = false

# Warns in the presence of code lines longer than a configured maximum.
[[linters-settings.revive.rules]]
name = "line-length-limit"
disabled = true
arguments = [150]

# Packages declaring too many public structs can be hard to understand/use, and could be a symptom of bad design.
[[linters-settings.revive.rules]]
name = "max-public-structs"
disabled = true             # Silly rule, IMO

# A function that modifies its parameters can be hard to understand. It can also be misleading if the arguments are passed by value by the caller. This rule warns when a function modifies one or more of its parameters.
[[linters-settings.revive.rules]]
name = "modifies-parameter"
disabled = true             # Too many false positives

# A method that modifies its receiver value can have undesired behavior. The modification can be also the root of a bug because the actual value receiver could be a copy of that used at the calling site. This rule warns when a method modifies its receiver.
[[linters-settings.revive.rules]]
name = "modifies-value-receiver"
disabled = false

# Packages declaring structs that contain other inline struct definitions can be hard to understand/read for other developers.
[[linters-settings.revive.rules]]
name = "nested-structs"
disabled = false

# Conditional expressions can be written to take advantage of short circuit evaluation and speed up its average evaluation time by forcing the evaluation of less time-consuming terms before more costly ones. This rule spots logical expressions where the order of evaluation of terms seems non optimal. Please notice that confidence of this rule is low and is up to the user to decide if the suggested rewrite of the expression keeps the semantics of the original one.
[[linters-settings.revive.rules]]
name = "optimize-operands-order"
disabled = true                  # too many wrong suggestions

# Packages should have comments. This rule warns on undocumented packages and when packages comments are detached to the package keyword.
[[linters-settings.revive.rules]]
name = "package-comments"
disabled = true           # Buggy, complains about every file

# This rule suggests a shorter way of writing ranges that do not use the second value.
[[linters-settings.revive.rules]]
name = "range"
disabled = false

# Range variables in a loop are reused at each iteration; therefore a goroutine created in a loop will point to the range variable with from the upper scope. This way, the goroutine could use the variable with an undesired value. This rule warns when a range value (or index) is used inside a closure.
[[linters-settings.revive.rules]]
name = "range-val-in-closure"
disabled = true               # Obsoleted by Go 1.22

# Range variables in a loop are reused at each iteration. This rule warns when assigning the address of the variable, passing the address to append() or using it in a map.
[[linters-settings.revive.rules]]
name = "range-val-address"
disabled = true            # Obsoleted by Go 1.22

# By convention, receiver names in a method should reflect their identity. For example, if the receiver is of type Parts, p is an adequate name for it. Contrary to other languages, it is not idiomatic to name receivers as this or self.
[[linters-settings.revive.rules]]
name = "receiver-naming"
disabled = false

# Constant names like false, true, nil, function names like append, make, and basic type names like bool, and byte are not reserved words of the language; therefore the can be redefined. Even if possible, redefining these built in names can lead to bugs very difficult to detect.
[[linters-settings.revive.rules]]
name = "redefines-builtin-id"
disabled = false

# explicit type conversion string(i) where i has an integer type other than rune might behave not as expected by the developer (e.g. string(42) is not "42"). This rule spot that kind of suspicious conversions.
[[linters-settings.revive.rules]]
name = "string-of-int"
disabled = false

# This rule allows you to configure a list of regular expressions that string literals in certain function calls are checked against. This is geared towards user facing applications where string literals are often used for messages that will be presented to users, so it may be desirable to enforce consistent formatting.
[[linters-settings.revive.rules]]
name = "string-format"
disabled = true        # Possibly worth configuring this later
# arguments = [ ... ]

# Struct tags are not checked at compile time. This rule, checks and warns if it finds errors in common struct tags types like: asn1, default, json, protobuf, xml, yaml.
[[linters-settings.revive.rules]]
name = "struct-tag"
disabled = false

# To improve the readability of code, it is recommended to reduce the indentation as much as possible. This rule highlights redundant else-blocks that can be eliminated from the code.
[[linters-settings.revive.rules]]
name = "superfluous-else"
disabled = false

# his rule warns when using == and != for equality check time.Time and suggest to time.time.Equal method.
[[linters-settings.revive.rules]]
name = "time-equal"
disabled = false

# Using unit-specific suffix like "Secs", "Mins", ... when naming variables of type time.Duration can be misleading, this rule highlights those cases.
[[linters-settings.revive.rules]]
name = "time-naming"
disabled = false

# This rule warns when initialism, variable or package naming conventions are not followed.
[[linters-settings.revive.rules]]
name = "var-naming"
disabled = false

# This rule proposes simplifications of variable declarations.
[[linters-settings.revive.rules]]
name = "var-declaration"
disabled = true          # duplicate of gofumpt

# Unconditional recursive calls will produce infinite recursion, thus program stack overflow. This rule detects and warns about unconditional (direct) recursive calls.
[[linters-settings.revive.rules]]
name = "unconditional-recursion"
disabled = false

# This rule warns on wrongly named un-exported symbols, i.e. un-exported symbols whose name start with a capital letter.
[[linters-settings.revive.rules]]
name = "unexported-naming"
disabled = false

# This rule warns when an exported function or method returns a value of an un-exported type.
[[linters-settings.revive.rules]]
name = "unexported-return"
disabled = false

# This rule warns when errors returned by a function are not explicitly handled on the caller side.
[[linters-settings.revive.rules]]
name = "unhandled-error"
disabled = true          # duplicate of errcheck

# This rule suggests to remove redundant statements like a break at the end of a case block, for improving the code's readability.
[[linters-settings.revive.rules]]
name = "unnecessary-stmt"
disabled = false

# This rule spots and proposes to remove unreachable code.
[[linters-settings.revive.rules]]
name = "unreachable-code"
disabled = false

# This rule warns on unused parameters. Functions or methods with unused parameters can be a symptom of an unfinished refactoring or a bug.
[[linters-settings.revive.rules]]
name = "unused-parameter"
disabled = false

# This rule warns on unused method receivers. Methods with unused receivers can be a symptom of an unfinished refactoring or a bug.
[[linters-settings.revive.rules]]
name = "unused-receiver"
disabled = false

# Since GO 1.18, interface{} has an alias: any. This rule proposes to replace instances of interface{} with any.
[[linters-settings.revive.rules]]
name = "use-any"
disabled = false

# This rule warns on useless break statements in case clauses of switch and select statements.
[[linters-settings.revive.rules]]
name = "useless-break"
disabled = false

# Function parameters that are passed by value, are in fact a copy of the original argument. Passing a copy of a sync.WaitGroup is usually not what the developer wants to do. This rule warns when a sync.WaitGroup expected as a by-value parameter in a function or method.
[[linters-settings.revive.rules]]
name = "waitgroup-by-value"
disabled = false

[[linters-settings.revive.rules]]
name = "enforce-repeated-arg-type-style"
disabled = true                          # Duplicate of gosimple

Go environment

$ go version && go env
go version go1.22.0 linux/amd64
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/jonhall/.cache/go-build'
GOENV='/home/jonhall/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/jonhall/go/pkg/mod'
GONOPROXY='gitlab.com/FlashbackSRS/priv,gitlab.com/flimzy/hacker-portfolio'
GONOSUMDB='gitlab.com/FlashbackSRS/priv,gitlab.com/flimzy/hacker-portfolio'
GOOS='linux'
GOPATH='/home/jonhall/go'
GOPRIVATE='gitlab.com/FlashbackSRS/priv,gitlab.com/flimzy/hacker-portfolio'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.0'
GCCGO='/usr/bin/gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/jonhall/src/float/float-core/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4265126551=/tmp/go-build -gno-record-gcc-switches'

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /home/jonhall/src/float/float-core /home/jonhall/src/float /home/jonhall/src /home/jonhall /home /] 
INFO [config_reader] Used config file .golangci.toml 
INFO [lintersdb] Active 32 linters: [bodyclose containedctx depguard dupword errcheck errchkjson errname errorlint forbidigo gci gochecknoglobals gochecknoinits gocritic gofumpt gosec gosimple govet ineffassign misspell nestif noctx nolintlint prealloc revive rowserrcheck sqlclosecheck staticcheck thelper tparallel unconvert unparam unused] 
INFO [loader] Go packages loading at mode 575 (compiled_files|name|types_sizes|deps|exports_file|files|imports) took 409.199498ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 20.526285ms 
INFO [linters_context/goanalysis] analyzers took 1m29.599781394s with top 10 stages: gocritic: 38.284479157s, buildir: 30.978864247s, inspect: 2.779039909s, fact_deprecated: 1.316049988s, printf: 1.127249393s, ctrlflow: 923.753902ms, gosec: 796.36056ms, unparam: 781.453499ms, gofumpt: 756.307489ms, buildssa: 714.498319ms 
WARN [runner] Can't run linter goanalysis_metalinter: the_only_name: cannot find rule: enforce-repeated-arg-type-style 
INFO [runner] processing took 2.242µs with stages: max_same_issues: 330ns, nolint: 300ns, skip_dirs: 300ns, source_code: 150ns, autogenerated_exclude: 140ns, path_prettifier: 131ns, cgo: 130ns, identifier_marker: 120ns, filename_unadjuster: 120ns, skip_files: 110ns, max_from_linter: 70ns, uniq_by_line: 41ns, exclude-rules: 40ns, diff: 40ns, path_shortener: 40ns, sort_results: 30ns, fixer: 30ns, max_per_file_from_linter: 30ns, path_prefixer: 30ns, exclude: 30ns, severity-rules: 30ns 
INFO [runner] linters took 7.810229982s with stages: goanalysis_metalinter: 7.810191009s 
ERRO Running error: can't run linter goanalysis_metalinter
the_only_name: cannot find rule: enforce-repeated-arg-type-style 
INFO Memory: 83 samples, avg is 1173.2MB, max is 2117.0MB 
INFO Execution took 8.244081114s                  

A minimal reproducible example or link to a public repository

// add your code here

Validation

  • Yes, I've included all information above (version, config, etc.).
@flimzy flimzy added the bug Something isn't working label Feb 7, 2024
@ldez ldez self-assigned this Feb 7, 2024
@ldez ldez added the dependencies Relates to an upstream dependency label Feb 7, 2024
@ldez
Copy link
Member

ldez commented Feb 7, 2024

@ldez
Copy link
Member

ldez commented Feb 7, 2024

I can create 2 possible fixes inside golangci-lint (removing this rule, copy-paste the code from revive) but we will wait for feedback from the revive team.

mgechev/revive#970

For now, as a workaround, the enable-all-rules: true or enforce-repeated-arg-type-style should not be used.

@denisvmedia
Copy link

denisvmedia commented Feb 7, 2024

I've just released a new version: https://github.com/mgechev/revive/releases/tag/v1.3.7
It however has more than the given fix (as we use a single master branch), hopefully there won't be other issues with it.

@denisvmedia
Copy link

#4355 this failed most likely because of mgechev/revive#969, but I didn't investigate deeper, and I'm not sure on which side it should be fixed.

@ldez
Copy link
Member

ldez commented Feb 7, 2024

I will investigate

@mfederowicz
Copy link

#4355 this failed most likely because of mgechev/revive#969, but I didn't investigate deeper, and I'm not sure on which side it should be fixed.

hey as far as i remember mgechev/revive#969 - replace ImportsBlacklistRule to ImportsBlocklistRule (using of course dedicated function: actualRuleName), and rule EnforceRepeatedArgTypeStyleRule was added in mgechev/revive#953 (and not added to config/config.go file to allRules list) - so maybe error revealed as a result of using old config files or something (just guessing).

so my suggestion @denisvmedia is that after adding a new rule, we should also add some tests for checking content of required maps/lists

@denisvmedia
Copy link

@mfederowicz this was the reason: https://github.com/golangci/golangci-lint/pull/4355/files#diff-a133b3199860b0c64f3827116b9a35c9154cd171062ec70c2c94591788f015a0R293

@ldez ldez closed this as completed in #4355 Feb 7, 2024
@leonklingele
Copy link
Member

Thanks! 😊 When is the v1.56.1 release coming?

@ldez
Copy link
Member

ldez commented Feb 7, 2024

I think we will wait 1 or 2 days, just to have some feedback on the other linters.
For now, there is workaround #4353 (comment)

@flimzy
Copy link
Author

flimzy commented Feb 8, 2024

I'm happy to see a quick fix to this. I'd love to see 1.56.1 released ASAP. This is preventing us from updating to Go 1.22. Version numbers are free, after all 😉

@ldez
Copy link
Member

ldez commented Feb 8, 2024

Version numbers are free

yes but my time is not free 😉

Anyway, as I expected another bug was reported, I think we will create a release today (UE timezone).


Sponsoring is a good way to sustain open source maintainers: sponsor me

@flimzy
Copy link
Author

flimzy commented Feb 8, 2024

Sponsoring is a good way to sustain open source maintainers

Done and done!

@denisvmedia
Copy link

denisvmedia commented Feb 8, 2024

[[linters-settings.revive.rules]]
name = "enforce-repeated-arg-type-style"
disabled = true # Duplicate of gosimple

@flimzy btw, I don't really think that the linter rule you tried to disable is a duplicate of gosimple. There doesn't seem to be any exact (or even similar) check in it. It might be my ignorance though.

P.S. Although it's mostly off topic for this thread, I just think it's worth to note it so that if anyone later comes to this thread doesn't get confused.

@flimzy
Copy link
Author

flimzy commented Feb 9, 2024

btw, I don't really think that the linter rule you tried to disable is a duplicate of gosimple

@denisvmedia You're right. The comment mentions gosimple, but gocritic is the the linter that should be mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Relates to an upstream dependency
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants