Skip to content

go-ruleguard doesn't work since release 1.37.0, last working release is 1.36.0 #2172

Closed
@aojea

Description

@aojea

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. (https://golangci-lint.run/usage/linters/)

Description of the problem

Using the example described here to use go-ruleguard rules with golangci-lint

#912 (comment)

If I use version 1.36.0 or older, it works:

~/Downloads/golangci-lint-1.36.0-linux-amd64/golangci-lint run example.go 
example.go:6:9: ruleguard: can rewrite as xs[0] == ys[0] (gocritic)
	return !(xs[0] != ys[0])

If I use version 1.37.0 or newer, it does not work, no output:

~/Downloads/golangci-lint-1.37.0-linux-amd64/golangci-lint run example.go
echo $?
0
~/Downloads/golangci-lint-1.38.0-linux-amd64/golangci-lint run example.go
echo $?
0
golangci-lint run example.go #latest stable
echo $?
0

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version v1.41.1 built from (unknown, mod sum: "h1:KH28pTSqRu6DTXIAANl1sPXNCmqg4VEH21z6G9Wj4SM=") on (unknown)

and all the published releases until 1.36.0

Configuration file

$ cat .golangci.yml
linters:
  enable:
    - gocritic
linters-settings:
  gocritic:
    enabled-checks:
      - ruleguard
    settings:
      ruleguard:
        rules: "rules.go"

Go environment

$ go version && go env
go version go1.16 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/aojea/.cache/go-build"
GOENV="/home/aojea/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/aojea/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/aojea/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3018424698=/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/aojea/tmp /home/aojea /home /] 
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 11 linters: [deadcode errcheck gocritic gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck] 
INFO [loader] Go packages loading at mode 575 (deps|name|types_sizes|compiled_files|exports_file|files|imports) took 8.463355ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 141.868µs 
INFO [linters context/goanalysis] analyzers took 9.111915ms with top 10 stages: gocritic: 4.91406ms, buildir: 390.344µs, ctrlflow: 358.986µs, fact_deprecated: 240.528µs, nilness: 196.467µs, printf: 196.288µs, typedness: 175.247µs, fact_purity: 154.578µs, deadcode: 148.82µs, ineffassign: 96.892µs 
INFO [runner] processing took 7.873µs with stages: max_same_issues: 1.326µs, skip_dirs: 687ns, max_from_linter: 662ns, nolint: 591ns, cgo: 500ns, skip_files: 448ns, autogenerated_exclude: 350ns, filename_unadjuster: 337ns, uniq_by_line: 334ns, exclude-rules: 333ns, identifier_marker: 328ns, path_prettifier: 324ns, exclude: 243ns, max_per_file_from_linter: 219ns, source_code: 216ns, path_shortener: 210ns, sort_results: 198ns, diff: 193ns, severity-rules: 191ns, path_prefixer: 183ns 
INFO [runner] linters took 47.704004ms with stages: goanalysis_metalinter: 47.556197ms 
INFO File cache stats: 0 entries of total size 0B 
INFO Memory: 2 samples, avg is 72.8MB, max is 73.3MB 
INFO Execution took 60.35258ms    

Code example or link to a public repository

// add your code here

Example here #912 (comment)

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