Skip to content

Conflicts gofumpt and gci for imports #1942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 tasks done
Dentrax opened this issue Apr 29, 2021 · 1 comment
Closed
4 tasks done

Conflicts gofumpt and gci for imports #1942

Dentrax opened this issue Apr 29, 2021 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@Dentrax
Copy link

Dentrax commented Apr 29, 2021

  • 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

Your description

Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 1.39.0 built from 9aea4aee on 2021-03-26T08:02:53Z
Config file
$ cat .golangci.yml
linters:
  enable-all: true
  disable:
    - lll
    - gomnd
    - gochecknoglobals
    - funlen
    - gocognit
    - testpackage
    - exhaustivestruct
    - scopelint
    - cyclop
    - nlreturn
    - wrapcheck
Go environment
$ go version && go env
go version go1.16.3 darwin/amd64
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/furkan.turkal/Library/Caches/go-build"
GOENV="/Users/furkan.turkal/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/furkan.turkal/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/furkan.turkal/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/local/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.3"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/furkan.turkal/go/src/foo/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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/nq/vxjjn3311fg4q263qsxrghpcpzgp66/T/go-build410067483=/tmp/go-build -gno-record-gcc-switches -fno-common"
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /Users/furkan.turkal/go/src/foo /Users/furkan.turkal/go/src /Users/furkan.turkal/go /Users/furkan.turkal /Users /] 
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 63 linters: [asciicheck bodyclose deadcode depguard dogsled dupl durationcheck errcheck errorlint exhaustive exportloopref forbidigo forcetypeassert gci gochecknoinits goconst gocritic gocyclo godot godox goerr113 gofmt gofumpt goheader goimports golint gomoddirectives gomodguard goprintffuncname gosec gosimple govet ifshort importas ineffassign interfacer makezero maligned misspell nakedret nestif nilerr noctx nolintlint paralleltest prealloc predeclared revive rowserrcheck sqlclosecheck staticcheck structcheck stylecheck thelper tparallel typecheck unconvert unparam unused varcheck wastedassign whitespace wsl] 
INFO [loader] Go packages loading at mode 575 (files|deps|exports_file|name|types_sizes|compiled_files|imports) took 1.484186082s 
WARN [runner] The linter 'interfacer' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner.  
WARN [runner] The linter 'maligned' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner.  Replaced by govet 'fieldalignment'. 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 1.463418ms 
INFO [linters context/goanalysis] analyzers took 50.480482685s with top 10 stages: buildir: 26.849674082s, exhaustive: 2.280527159s, fact_deprecated: 2.00516964s, ctrlflow: 1.692937544s, inspect: 1.614147408s, the_only_name: 1.525289669s, nilness: 1.424585676s, printf: 1.356559223s, fact_purity: 1.336858254s, typedness: 1.066812287s 
INFO [runner/max_same_issues] 36/39 issues with text "non-wrapping format verb for fmt.Errorf. Use `%w` to format errors" were hidden, use --max-same-issues 
INFO [runner/max_same_issues] 29/32 issues with text "File is not `gofumpt`-ed" were hidden, use --max-same-issues 
INFO [runner/max_same_issues] 4/7 issues with text "return statements should not be cuddled if block has more than two lines" were hidden, use --max-same-issues 
INFO [runner/max_same_issues] 3/6 issues with text "don't use `init` function" were hidden, use --max-same-issues 
INFO [runner/max_same_issues] 3/6 issues with text "assignments should only be cuddled with other assignments" were hidden, use --max-same-issues 
INFO [runner/max_same_issues] 1/4 issues with text "if statements should only be cuddled with assignments" were hidden, use --max-same-issues 
INFO [runner] Issues before processing: 237, after processing: 59 
INFO [runner] Processors filtering stat (out/in): diff: 135/135, max_per_file_from_linter: 135/135, max_same_issues: 59/135, source_code: 59/59, severity-rules: 59/59, sort_results: 59/59, skip_files: 237/237, skip_dirs: 237/237, path_shortener: 59/59, nolint: 183/183, max_from_linter: 59/59, autogenerated_exclude: 237/237, identifier_marker: 237/237, exclude: 237/237, exclude-rules: 183/237, uniq_by_line: 135/183, cgo: 237/237, filename_unadjuster: 237/237, path_prettifier: 237/237, path_prefixer: 59/59 
INFO [runner] processing took 21.511434ms with stages: exclude-rules: 7.97547ms, identifier_marker: 6.642283ms, nolint: 3.038591ms, autogenerated_exclude: 1.41304ms, path_prettifier: 1.05879ms, source_code: 538.245µs, cgo: 453.082µs, skip_dirs: 135.365µs, max_same_issues: 127.822µs, uniq_by_line: 44.686µs, filename_unadjuster: 35.604µs, max_from_linter: 17.231µs, max_per_file_from_linter: 16.372µs, path_shortener: 12.813µs, diff: 444ns, exclude: 408ns, skip_files: 351ns, severity-rules: 341ns, sort_results: 318ns, path_prefixer: 178ns 
INFO [runner] linters took 7.059613348s with stages: goanalysis_metalinter: 7.037649005s

// ...
main.go:23: File is not `gci`-ed (gci)
        "cocert/cmd"
main.go:25: File is not `gci`-ed (gci)
        "os"
// ...

INFO File cache stats: 31 entries of total size 78.0KiB 
INFO Memory: 87 samples, avg is 405.7MB, max is 613.1MB 
INFO Execution took 8.575594434s 

Minimum reproducible snippet:

Input:

package main

import (
	"foo/cmd"
	"fmt"
	"os"
)

Run:

$ golangci-lint run .

Output:

main.go:23: File is not `gci`-ed (gci)
        "foo/cmd"
main.go:25: File is not `gci`-ed (gci)
        "os"

Run:

$ gci -w main.go

Input:

package main

import (
	"fmt"
	"os"

	"cocert/cmd"
)

Run again:

$ golangci-lint run .
main.go:22: File is not `gofumpt`-ed (gofumpt)
import (
main.go:25: File is not `gofumpt`-ed (gofumpt)

        "foo/cmd"

Run:

$ gofumpt -w main.go

CONFLICT:

main.go:23: File is not `gci`-ed (gci)
        "cocert/cmd"
main.go:25: File is not `gci`-ed (gci)
        "os"

Run again:

$ golangci-lint run .
@Dentrax Dentrax added the bug Something isn't working label Apr 29, 2021
@ldez
Copy link
Member

ldez commented Apr 29, 2021

duplicate of #1490

@ldez ldez closed this as completed Apr 29, 2021
@ldez ldez added duplicate This issue or pull request already exists and removed bug Something isn't working labels Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants