Skip to content

Revive doesn't complain about unused parameters #3653

Closed
@walles

Description

@walles

Welcome

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc.).
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.). (https://golangci-lint.run/usage/linters/)

Description of the problem

golangci-lint's Revive documentation says unused-parameter is not disabled:

      ...
      # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
      - name: unused-parameter
        severity: warning
        disabled: false
      ...

But enabling Revive and running it on an example program gives me no unused-parameter diagnostics.

I would like to have Revive tell me about unused parameters.

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 1.51.2 built from 3e8facb on 2023-02-19T20:54:52Z

Configuration file

$ cat .golangci.yml
cat: .golangci.yml: No such file or directory

Go environment

$ go version && go env
go version go1.20.1 darwin/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/johan/Library/Caches/go-build"
GOENV="/Users/johan/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/johan/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/johan/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.20.1/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.20.1/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.20.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/cg/d7qzk4s13s9c8t49t3txdjpr0000gn/T/go-build1895242244=/tmp/go-build -gno-record-gcc-switches -fno-common"

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
/tmp $ golangci-lint cache clean && golangci-lint run -v -E revive pajj.go
INFO [config_reader] Config search paths: [./ /tmp / /Users/johan]
INFO [lintersdb] Active 8 linters: [errcheck gosimple govet ineffassign revive staticcheck typecheck unused]
INFO [loader] Go packages loading at mode 575 (deps|files|compiled_files|imports|name|types_sizes|exports_file) took 146.273377ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 260.315µs
INFO [linters_context/goanalysis] analyzers took 1.386377756s with top 10 stages: buildir: 919.560591ms, the_only_name: 91.219139ms, inspect: 61.130495ms, fact_purity: 50.928733ms, printf: 50.508523ms, SA5012: 49.181698ms, ctrlflow: 46.243002ms, nilness: 39.059048ms, fact_deprecated: 36.182834ms, typedness: 33.668338ms
INFO [runner] Issues before processing: 1, after processing: 0
INFO [runner] Processors filtering stat (out/in): path_prettifier: 1/1, skip_dirs: 1/1, autogenerated_exclude: 1/1, identifier_marker: 1/1, exclude-rules: 0/1, cgo: 1/1, filename_unadjuster: 1/1, skip_files: 1/1, exclude: 1/1
INFO [runner] processing took 278.047µs with stages: identifier_marker: 71.354µs, autogenerated_exclude: 70.216µs, path_prettifier: 60.718µs, exclude-rules: 39.897µs, skip_dirs: 23.063µs, filename_unadjuster: 3.741µs, nolint: 2.917µs, cgo: 1.552µs, max_same_issues: 707ns, skip_files: 452ns, uniq_by_line: 446ns, diff: 438ns, source_code: 428ns, max_from_linter: 408ns, severity-rules: 370ns, path_shortener: 303ns, exclude: 298ns, sort_results: 294ns, path_prefixer: 245ns, max_per_file_from_linter: 200ns
INFO [runner] linters took 1.121494494s with stages: goanalysis_metalinter: 1.121028236s
INFO File cache stats: 0 entries of total size 0B
INFO Memory: 14 samples, avg is 164.3MB, max is 272.2MB
INFO Execution took 1.281886455s
/tmp $

Code example or link to a public repository

package main

import "fmt"

func hello(unused string) {
	fmt.Println("Hello")
}

func main() {
	hello("unused")
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions