Skip to content
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

gci: error after updating to version 1.44.1 #2592

Closed
4 tasks done
nclaeys opened this issue Feb 17, 2022 · 5 comments · Fixed by #2593
Closed
4 tasks done

gci: error after updating to version 1.44.1 #2592

nclaeys opened this issue Feb 17, 2022 · 5 comments · Fixed by #2593
Labels
bug Something isn't working

Comments

@nclaeys
Copy link

nclaeys commented Feb 17, 2022

Welcome

  • 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

The golang linter fails to run on our project after the latest update.
Error is:

ERRO Running error: 1 error occurred:
        * can't run linter goanalysis_metalinter: gci: an error occured while trying to parse imports: Found non-letter character '.' in Alias: .

It runs without issues when using version 1.44.0
Did something change, I could not find anything in the release notes?

Version of golangci-lint

golangci-lint has version 1.44.1 built from 9a70e9a4 on 2022-02-17T11:30:32Z

Configuration file

run:
  skip-dirs:
    - libs/golang-rest-client

  build-tags:
    - exclude_graphdriver_devicemapper
    - exclude_graphdriver_btrfs
    - containers_image_openpgp
  skip-dirs-use-default: true

linters:
  enable:
    - deadcode
    - errcheck
    - gosimple
    - govet
    - ineffassign
    - structcheck
    - typecheck
    - unused
    - varcheck
    - asciicheck
    - exhaustive
    - misspell
    - promlinter
    - predeclared
    - tparallel
    - whitespace
    - wastedassign
    - importas
    - gci
    - godot
    - gocritic
    - tparallel
    - unconvert
    - makezero
  disable-all: true

linters-settings:
  goimports:
    local-prefixes: datafy.cloud/datafy
  exhaustive:
    default-signifies-exhaustive: true
  importas:
    no-unaliased: true
    alias:
      - pkg: k8s.io/api/core/v1
        alias: corev1
      - pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
        alias: apiextensionsv1
      - pkg: k8s.io/apimachinery/pkg/apis/meta/v1
        alias: metav1
      - pkg: k8s.io/apimachinery/pkg/api/errors
        alias: apierrors
      - pkg: k8s.io/apimachinery/pkg/util/errors
        alias: kerrors
      - pkg: sigs.k8s.io/controller-runtime
        alias: ctrl
      - pkg: datafy.cloud/datafy/data-plane/operator/apis/runtime/v1
        alias: runtimev1
      - pkg: datafy.cloud/datafy/data-plane/operator/apis/airflow/v1
        alias: airflowv1
      - pkg: datafy.cloud/datafy/data-plane/operator/controllers/runtime/utils
        alias: runtimeutils
      - pkg: datafy.cloud/datafy/libs/golang-grpc-api
        alias: api
      - pkg: datafy.cloud/datafy/data-plane/operator/apis/core/v1
        alias: datafycorev1
      - pkg: k8s.io/api/events/v1
        alias: eventsv1
      - pkg: sigs.k8s.io/secrets-store-csi-driver/apis/v1
        alias: secretsv1
  gocritic:
    disabled-checks:
      - commentFormatting

Go environment

go version go1.17.2 linux/amd64
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="~/.cache/go-build"
GOENV="~/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="~/go/pkg/mod"
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"
GOVCS=""
GOVERSION="go1.17.2"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="~/workspace/dataminded/lighthouse-datafy/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-build2717589525=/tmp/go-build -gno-record-gcc-switches"

Verbose output of running

$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /~/workspace/dataminded/lighthouse-datafy ~/workspace/dataminded /~/workspace ~ /home /] 
INFO [config_reader] Used config file .golangci.yaml 
INFO [lintersdb] Active 23 linters: [asciicheck deadcode errcheck exhaustive gci gocritic godot gosimple govet importas ineffassign makezero misspell predeclared promlinter structcheck tparallel typecheck unconvert unused varcheck wastedassign whitespace] 
INFO [loader] Using build tags: [exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp] 
INFO [loader] Go packages loading at mode 575 (types_sizes|compiled_files|exports_file|files|imports|deps|name) took 2.908613866s 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 100.006008ms 
INFO [linters context/goanalysis] analyzers took 7m23.591631685s with top 10 stages: buildir: 3m6.414639652s, wastedassign: 53.32562452s, buildssa: 51.466854951s, whitespace: 19.735348106s, unconvert: 13.797497321s, gocritic: 10.243986736s, exhaustive: 9.783008069s, unused: 6.755357772s, inspect: 6.169738341s, printf: 4.265938614s 
WARN [runner] Can't run linter goanalysis_metalinter: gci: an error occured while trying to parse imports: Found non-letter character '.' in Alias: . 
INFO [runner] processing took 3.048µs with stages: identifier_marker: 441ns, max_same_issues: 368ns, skip_dirs: 321ns, nolint: 282ns, skip_files: 205ns, max_from_linter: 201ns, path_prettifier: 150ns, filename_unadjuster: 130ns, exclude: 130ns, autogenerated_exclude: 127ns, cgo: 115ns, uniq_by_line: 113ns, source_code: 110ns, max_per_file_from_linter: 105ns, sort_results: 45ns, path_shortener: 42ns, diff: 42ns, path_prefixer: 41ns, exclude-rules: 40ns, severity-rules: 40ns 
INFO [runner] linters took 36.407492014s with stages: goanalysis_metalinter: 36.407458559s 
ERRO Running error: 1 error occurred:
        * can't run linter goanalysis_metalinter: gci: an error occured while trying to parse imports: Found non-letter character '.' in Alias: .
 
INFO Memory: 328 samples, avg is 2002.8MB, max is 3776.3MB 
INFO Execution took 39.421191646s  

Code example or link to a public repository

The repository is not public
@nclaeys nclaeys added the bug Something isn't working label Feb 17, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Feb 17, 2022

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@ldez ldez changed the title Goanalysis metalinter error after updating to version 1.44.1 error after updating to version 1.44.1 Feb 17, 2022
@ldez ldez changed the title error after updating to version 1.44.1 gci: error after updating to version 1.44.1 Feb 17, 2022
@ldez
Copy link
Member

ldez commented Feb 17, 2022

Hello,

gci: an error occured while trying to parse imports: Found non-letter character '.' in Alias: .

The problem is related to gci.

@bombsimon
Copy link
Member

From https://github.com/golangci/golangci-lint/releases/tag/v1.44.1:

* bump github.com/daixiang0/gci from 0.2.9 to 0.3.0 (#2532)

@ldez
Copy link
Member

ldez commented Feb 17, 2022

Seems like a bug inside GCI https://github.com/daixiang0/gci

@ldez
Copy link
Member

ldez commented Feb 17, 2022

ok, it's already fixed in gci daixiang0/gci#45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants