Skip to content

staticcheck linter does not report S1023 and SA4011 #853

Closed
@egonelbre

Description

@egonelbre

Apparently S1023 and SA4011 are never being reported when you only enable staticcheck in golangci-lint. But, when you run staticcheck separately it'll report the issues.

S1023 seems to be part of gosimple, but it's weird that it's needed at all, since I would assume it's part of staticcheck already.

SA4011, of course seems to be missing entirely.


Thank you for creating the issue!

  • 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).

Please include the following information:

Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 1.21.0 built from 645e794 on 2019-10-15T18:15:04Z
Config file
linters:
  enable:
    - staticcheck # comprehensive checks
  disable:
    - gosimple    # already part of staticcheck
  fast: false
Go environment
$ go version && go env
go version go1.13.4 windows/amd64
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=Z:\gocache
set GOENV=C:\Users\egone\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=F:\Go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=f:\tmp\testcase\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=Z:\Temp\go-build550745574=/tmp/go-build -gno-record-gcc-switches
Code
package main

import "fmt"

func main() {
	x := 0
	for {
		x++
		switch x {
		case 1:
			fmt.Println("A", x)
			break
		case 2:
			fmt.Println("B", x)
			break
		default:
			break
		}
	}
}
Verbose output of running
$ golangci-lint run -v
level=info msg="[config_reader] Config search paths: [./ f:\\tmp\\testcase f:\\tmp f:\\]"
level=info msg="[config_reader] Used config file .golangci.yml"
level=info msg="[lintersdb] Active 9 linters: [deadcode errcheck govet ineffassign staticcheck structcheck typecheck unused varcheck]"
level=info msg="[loader] Go packages loading at mode 575 (compiled_files|exports_file|imports|name|deps|files|types_sizes) took 272.1129ms"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 988.4µs"
level=info msg="[runner/unused/goanalysis] analyzers took 2.0096ms with top 10 stages: buildssa: 2.0096ms, U1000: 0s"
level=info msg="[runner/goanalysis_metalinter/goanalysis] analyzers took 2.7266467s with top 10 stages: fact_purity: 639.5345ms, ctrlflow: 552.987ms, fact_deprecated: 527.7724ms, printf: 512.9744ms, buildssa: 458.8842ms, inspect: 34.4942ms, SA3000: 0s, SA4021: 0s, SA1015: 0s, SA4010: 0s"
level=info msg="[runner] Issues before processing: 3, after processing: 0"
level=info msg="[runner] Processors filtering stat (out/in): filename_unadjuster: 3/3, skip_files: 3/3, autogenerated_exclude: 3/3, identifier_marker: 3/3, path_prettifier: 3/3, skip_dirs: 3/3, cgo: 3/3, exclude: 0/3"
level=info msg="[runner] processing took 998.5µs with stages: autogenerated_exclude: 998.5µs, exclude-rules: 0s, max_same_issues: 0s, source_code: 0s, skip_files: 0s, filename_unadjuster: 0s, exclude: 0s, nolint: 0s, diff: 0s, max_per_file_from_linter: 0s, max_from_linter: 0s, cgo: 0s, uniq_by_line: 0s, identifier_marker: 0s, path_shortener: 0s, skip_dirs: 0s, path_prettifier: 0s"
level=info msg="[runner] linters took 1.6427939s with stages: goanalysis_metalinter: 1.5437952s, unused: 80.0014ms"
level=info msg="File cache stats: 0 entries of total size 0B"
level=info msg="Memory: 21 samples, avg is 81.8MB, max is 135.9MB"
level=info msg="Execution took 1.9921699s"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdependenciesRelates to an upstream dependency

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions