Closed
Description
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.23.7 built from 96964db on 2020-02-28T12:07:44Z
Config file
$ cat .golangci.yml
cat: .golangci.yml: No such file or directory
Go environment
$ go version && go env
go version go1.13.8 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/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"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/golang/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 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build155065711=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
$ golangci-lint run -v --disable-all -E unused --out-format code-climate
INFO [config_reader] Config search paths: [./ /golang /]
INFO [lintersdb] Active 1 linters: [unused]
INFO [lintersdb] Active 1 linters: [unused]
INFO [loader] Go packages loading at mode 575 (types_sizes|compiled_files|exports_file|name|deps|files|imports) took 213.082062ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 2.243655ms
INFO [runner/unused/goanalysis] analyzers took 0s with no stages
INFO [runner] Processors filtering stat (out/in): autogenerated_exclude: 4/4, diff: 4/4, max_per_file_from_linter: 4/4, filename_unadjuster: 4/4, skip_files: 4/4, identifier_marker: 4/4, exclude: 4/4, uniq_by_line: 4/4, max_from_linter: 4/4, path_shortener: 4/4, cgo: 4/4, path_prettifier: 4/4, nolint: 4/4, max_same_issues: 4/4, source_code: 4/4, skip_dirs: 4/4, exclude-rules: 4/4
INFO [runner] processing took 1.029837ms with stages: nolint: 851.63µs, exclude: 75.418µs, identifier_marker: 35.178µs, autogenerated_exclude: 22.674µs, path_prettifier: 19.401µs, skip_dirs: 9.853µs, max_same_issues: 3.652µs, uniq_by_line: 3.158µs, max_from_linter: 1.976µs, path_shortener: 1.611µs, cgo: 1.43µs, filename_unadjuster: 1.005µs, source_code: 933ns, max_per_file_from_linter: 830ns, skip_files: 538ns, diff: 326ns, exclude-rules: 224ns
INFO [runner] linters took 56.885007ms with stages: unused: 55.778981ms
INFO Memory: 4 samples, avg is 71.5MB, max is 72.1MB
INFO Execution took 276.702411ms
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
github.com/golangci/golangci-lint/pkg/printers.CodeClimate.Print(0x10f14a0, 0xc000185b00, 0xc0011b4000, 0x4, 0x4, 0xc0001aad80, 0xfa8660)
/home/travis/gopath/src/github.com/golangci/golangci-lint/pkg/printers/codeclimate.go:44 +0x52f
github.com/golangci/golangci-lint/pkg/commands.(*Executor).runAndPrint(0xc0000b2a00, 0x10f14a0, 0xc000185b00, 0xc000185a40, 0x0, 0x6, 0x0, 0x0)
/home/travis/gopath/src/github.com/golangci/golangci-lint/pkg/commands/run.go:372 +0x324
github.com/golangci/golangci-lint/pkg/commands.(*Executor).executeRun(0xc0000b2a00, 0xc000201b80, 0xc000185a40, 0x0, 0x6)
/home/travis/gopath/src/github.com/golangci/golangci-lint/pkg/commands/run.go:423 +0x17b
github.com/spf13/cobra.(*Command).execute(0xc000201b80, 0xc000185980, 0x6, 0x6, 0xc000201b80, 0xc000185980)
/home/travis/gopath/pkg/mod/github.com/spf13/[email protected]/command.go:830 +0x29d
github.com/spf13/cobra.(*Command).ExecuteC(0xc000201900, 0x6, 0x10bbb98, 0x7)
/home/travis/gopath/pkg/mod/github.com/spf13/[email protected]/command.go:914 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
/home/travis/gopath/pkg/mod/github.com/spf13/[email protected]/command.go:864
github.com/golangci/golangci-lint/pkg/commands.(*Executor).Execute(...)
/home/travis/gopath/src/github.com/golangci/golangci-lint/pkg/commands/executor.go:147
main.main()
/home/travis/gopath/src/github.com/golangci/golangci-lint/cmd/golangci-lint/main.go:21 +0x7e
Using golangci-lint with versions <= v1.21.0 and the unused
linter resulted in:
Output
$ golangci-lint run --disable-all -E unused
var Build = "dev"
^
version.go:9:6: func `version` is unused (unused)
func version() string {
^
version.go:7:5: var `GitRev` is unused (unused)
var GitRev = "gitrevhere"
^
model/company.go:366:6: func `stringSliceToInterfaceSlice` is unused (unused)
func stringSliceToInterfaceSlice(l []string) []interface{} {
^
while using it with versions > v1.21.0:
Output
$ golangci-lint run --disable-all -E unused
model/company.go:366:6: func `stringSliceToInterfaceSlice` is unused (unused)
version.go:9:6: func `version` is unused (unused)
version.go:7:5: var `GitRev` is unused (unused)
version.go:4:5: var `Build` is unused (unused)
As you can see, there are already differences in the 'default output'. When using it with code-climate it results in the panic posted in Verbose output of running
Metadata
Metadata
Assignees
Labels
No labels