Skip to content

gci: error after updating to version 1.44.1 #2592

Closed
@nclaeys

Description

@nclaeys

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions