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.
I only found an issue about "unused" being deprecated, but the linter is still enabled by default. - 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 v1.25.0 built from (unknown, mod sum: "h1:fwVdXtCBBCmk9e/7bTjkeCMx52bhq1IqmEQOVDbHXcg=") on (unknown)
Config file
$ cat .golangci.yml
linters:
enable:
- unused
disable:
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- varcheck
Go environment
$ go version && go env
go version go1.14.2 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/kv/.cache/go-build"
GOENV="/home/kv/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/kv/projects/lightstep/GOPATH"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/kv/projects/go/go-1.14"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/kv/projects/go/go-1.14/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/kv/projects/lightstep/opentelemetry-go/golangcitest/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-build361626896=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
$ golangci-lint run --verbose --fix
INFO [config_reader] Config search paths: [./ /home/kv/projects/lightstep/opentelemetry-go/golangcitest /home/kv/projects/lightstep/opentelemetry-go /home/kv/projects/lightstep /home/kv/projects /home/kv /home /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 1 linters: [unused]
INFO [lintersdb] Active 1 linters: [unused]
INFO [loader] Go packages loading at mode 575 (files|imports|name|types_sizes|compiled_files|deps|exports_file) took 11.011584ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 96.546µs
INFO [runner/unused/goanalysis] analyzers took 0s with no stages
INFO [runner] Processors filtering stat (out/in): exclude-rules: 1/1, nolint: 1/1, max_same_issues: 1/1, path_shortener: 1/1, skip_files: 1/1, autogenerated_exclude: 1/1, identifier_marker: 1/1, exclude: 1/1, filename_unadjuster: 1/1, skip_dirs: 1/1, uniq_by_line: 1/1, max_from_linter: 1/1, cgo: 1/1, path_prettifier: 1/1, diff: 1/1, max_per_file_from_linter: 1/1, source_code: 1/1
INFO [runner] processing took 230.911µs with stages: exclude: 59.691µs, identifier_marker: 40.053µs, nolint: 39.146µs, path_prettifier: 36.214µs, autogenerated_exclude: 29.213µs, skip_dirs: 17.098µs, path_shortener: 3.164µs, cgo: 1.341µs, max_same_issues: 873ns, uniq_by_line: 787ns, filename_unadjuster: 719ns, source_code: 711ns, max_from_linter: 454ns, skip_files: 438ns, max_per_file_from_linter: 401ns, diff: 349ns, exclude-rules: 259ns
INFO [runner] linters took 777.454µs with stages: unused: 452.184µs
INFO Fix issue &result.Issue{FromLinter:"unused", Text:"type `unused` is unused", SourceLines:[]string(nil), Replacement:(*result.Replacement)(0xc00033cdb0), Pkg:(*packages.Package)(0xc0000e4120), LineRange:(*result.Range)(0xc000350560), Pos:token.Position{Filename:"foo.go", Offset:40, Line:6, Column:2}, HunkPos:0} with range {6 0}
INFO fixer took 320.456µs with stages: all: 320.456µs
INFO File cache stats: 1 entries of total size 71B
INFO Memory: 2 samples, avg is 70.1MB, max is 70.1MB
INFO Execution took 17.559337ms
Input file foo.go
// COPYRIGHT
package anything
type (
unused struct{}
)
func X() {}
Corrupted input file
// COPYRIGHT
package anything
type (
// COPYRIGHT
package anything
type (
unused struct{}
)
func X() {}