Skip to content

revive: exported rule does not work #1937

Closed
@rittneje

Description

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

The exported rule from revive is completely ignored. However, if I run revive directly, it is properly applied.

https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#exported

Also, if I use golint in my .golangci.yml instead then these lines are properly flagged.

Version of golangci-lint
$ golangci-lint --version
golangci-lint has version v1.39.0 built from (unknown, mod sum: "h1:aAUjdBxARwkGLd5PU0vKuym281f2rFOyqh3GB4nXcq8=") on (unknown)
Config file
$ cat .golangci.yml
run:
  deadline: 5m
output:
  format: line-number
  print-issued-lines: false
  print-linter-name: true
linters-settings:
  revive:
    ignore-generated-header: true
    rules:
    - name: exported
linters:
  disable-all: true
  enable:
  - revive
issues:
  exclude-use-default: false
  max-issues-per-linter: 0
  max-same-issues: 0
Go environment
$ go version && go env
go version go1.15.11 darwin/amd64
GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOCACHE="/tmp/.gocache"
GOENV="/Users/rittneje/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/rittneje/gotools/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/rittneje/gotools"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/rittneje/go1.15.11"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/rittneje/go1.15.11/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
GOMOD="/Users/rittneje/revive-test/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/kf/kr7_s3xx0l12zbj3jrn082hmzy5gvy/T/go-build294807898=/tmp/go-build -gno-record-gcc-switches -fno-common"
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
level=info msg="[config_reader] Config search paths: [./ /Users/rittneje/revive-test /Users/rittneje /Users / /root]"
level=info msg="[config_reader] Used config file .golangci.yml"
level=info msg="[lintersdb] Active 1 linters: [revive]"
level=info msg="[loader] Go packages loading at mode 7 (files|name|compiled_files) took 33.2214ms"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 715.3µs"
level=info msg="[linters context/goanalysis] analyzers took 1.34ms with top 10 stages: the_only_name: 1.34ms"
level=info msg="[runner] processing took 108.8µs with stages: max_from_linter: 37.6µs, skip_dirs: 4.6µs, source_code: 4.5µs, max_same_issues: 4.5µs, nolint: 3.8µs, diff: 3.7µs, identifier_marker: 3.7µs, path_prettifier: 3.6µs, max_per_file_from_linter: 3.6µs, uniq_by_line: 3.6µs, filename_unadjuster: 3.6µs, exclude: 3.6µs, path_shortener: 3.6µs, autogenerated_exclude: 3.6µs, cgo: 3.6µs, severity-rules: 3.6µs, sort_results: 3.5µs, path_prefixer: 3.5µs, skip_files: 3.5µs, exclude-rules: 3.5µs"
level=info msg="[runner] linters took 12.9668ms with stages: revive: 12.5349ms"
level=info msg="File cache stats: 0 entries of total size 0B"
level=info msg="Memory: 2 samples, avg is 71.8MB, max is 71.8MB"
level=info msg="Execution took 54.3249ms"
Code example or link to a public repository
package sample

type Foo struct{}

func (Foo) Bar() {
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions