golangci / golangci-lint

Fast linters runner for Go
https://golangci-lint.run
GNU General Public License v3.0
15.69k stars 1.39k forks source link

goimports linter works incorrectly #255

Closed derElektrobesen closed 6 years ago

derElektrobesen commented 6 years ago
$ golangci-lint --version
golangci-lint has version 1.10.2 built from dbfcf63 on 2018-09-02T12:30:29Z

$ go version && go env
go version go1.10.2 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/p.berezhnoy/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/p.berezhnoy/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build415063740=/tmp/go-build -gno-record-gcc-switches"

$ golangci-lint run --build-tags="testing,integration" --new-from-rev=30a6969eb9 -v
INFO [config_reader] Config search paths: [./ /home/p.berezhnoy/go/src/gitlab.corp.mail.ru/swa/totem /home/p.berezhnoy/go/src/gitlab.corp.mail.ru/swa /home/p.berezhnoy/go/src/gitlab.corp.mail.ru /home/p.berezhnoy/go/src /home/p.berezhnoy/go /home/p.berezhnoy /home /]
INFO [config_reader] Used config file .golangci.yaml
INFO [lintersdb] Active 23 linters: [deadcode depguard dupl errcheck goconst gocyclo gofmt goimports golint gosec govet ineffassign interfacer lll megacheck misspell nakedret prealloc structcheck typecheck unconvert unparam varcheck]
INFO [load/path_resolver] Skipped dirs: [.git contrib/tarantool/third_party pkg/mapi/testdata testdata vendor]
INFO [load/path_resolver] Paths resolving took 21.533187ms: [cmd/realgar cmd/totem-contacts cmd/totem-dugong cmd/totem-koala cmd/totem-refresh contacter dugong fluor graph log merge pkg/arsenid pkg/cfgutils pkg/cli pkg/errors pkg/gdata pkg/mapi pkg/outlook pkg/retry pkg/tarantool.v15 pkg/tarantool.v15/tarantoolcfg pkg/tarantool.v15/tntgen pkg/tarantool.v15/tntgen pkg/tarantool.v15/tntgen/fixtures pkg/versionwatcher realgar realgar/api/avatars realgar/client realgar/collectord realgar/collectord/collector scripts/oauth2 sharder sharder/cache sharder/shard statutil test/fluor test/google testutil testutil/gomock/matchers testutil/gomock/mockarsenid testutil/gomock/mockcontacter testutil/gomock/mockfluorclient testutil/gomock/mockfluordb testutil/gomock/mockgraph testutil/gomock/mockmapi testutil/helpers testutil/integration testutil/logger testutil/mapicli testutil/roundtripper testutil/stat token token/provider version]
INFO [load] Program loading took 3.173999897s
INFO [load] SSA repr building took 942.862206ms
token/provider/provider.go:80: File is not `goimports`-ed (goimports)
                Conn: conn,
token/provider/mailru_test.go:33: File is not `goimports`-ed (goimports)
                                Proxy: http.ProxyFromEnvironment,
token/provider/microsoft_test.go:35: File is not `goimports`-ed (goimports)
                                Proxy: http.ProxyFromEnvironment,
INFO [runner] worker.1 took 3.153877313s with stages: unparam: 1.509490637s, interfacer: 1.113040524s, gofmt: 321.971201ms, ineffassign: 92.737353ms, varcheck: 37.326836ms, deadcode: 19.226282ms, errcheck: 14.932555ms, structcheck: 11.703101ms, unconvert: 10.178874ms, lll: 8.921362ms, goconst: 8.200436ms, nakedret: 6.052919ms, depguard: 5.685µs, typecheck: 4.989µs
INFO [runner] worker.3 took 3.311765594s with stages: golint: 3.311726464s
INFO [runner] worker.2 took 3.594665923s with stages: goimports: 1.711476466s, gosec: 836.003153ms, dupl: 780.874152ms, govet: 122.228598ms, misspell: 94.901101ms, gocyclo: 42.502298ms, prealloc: 6.623197ms
INFO [runner] worker.4 took 4.998705998s with stages: megacheck: 4.99867578s
INFO [runner] Workers idle times: #1: 1.844768221s, #2: 1.403943733s, #3: 1.686966527s
INFO [runner] processing took 2.772486161s with stages: diff: 2.725989394s, nolint: 20.384056ms, exclude: 14.98818ms, skip_files: 4.781297ms, autogenerated_exclude: 3.576312ms, path_prettifier: 1.652268ms, source_code: 404.457µs, uniq_by_line: 346.528µs, cgo: 298.356µs, max_per_file_from_linter: 36.164µs, max_same_issues: 17.996µs, max_from_linter: 11.153µs
INFO Memory: 66 samples, avg is 863.4MB, max is 1617.9MB
INFO Execution took 9.250031445s

goimports does nothing if i call goimports -w (-d also shows nothing)

Goimports was installed via go get:

~/go/src/golang.org/x/tools/cmd/goimports git:(master)
$ g log -1
commit a2dc47679d30b6c496245bafc6a166b46c5fe318
Author: Brad Fitzpatrick <bradfitz@golang.org>
Date:   Wed Oct 24 15:31:02 2018 +0000

    Revert "imports: support repairing import grouping/ordering"

    This reverts commit CL 116795 12a7c317e894c0a622b5ed27f0a102fcdd56d1ad.

    Reason for revert: mangles comments in imports. See comments
    on issue golang/go#20818.

    Updates golang/go#20818

    Change-Id: Iff82f8dc310dceb982b48d82b26176ea279fef10
    Reviewed-on: https://go-review.googlesource.com/c/144339
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
derElektrobesen commented 6 years ago

gofmt -s also does nothing

jirfag commented 6 years ago

thank you for the issue, please, try release v1.11

derElektrobesen commented 6 years ago

It works, thanks!