Skip to content

gci won't parse "alias" option #4347

@hahuang65

Description

@hahuang65

Welcome

Description of the problem

gci doesn't seem to accept the alias option in the config, even though golangci-lint 1.55.2 uses gci v0.12.1

Version of golangci-lint

$ go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest --version
golangci-lint has version v1.55.2 built with go1.21.6 from (unknown, mod sum: "h1:yllEIsSJ7MtlDBwDJ9IMBkyEUz2fYE0b5B8IUgO1oP8=") on (unknown)

Configuration

linters:
  enable:
    - errcheck
    - gosimple
    - govet
    - ineffassign
    - staticcheck
    - unused
    - gofumpt
    - gci
    - bodyclose
    - contextcheck
    - durationcheck
    - errcheck
    - errname
    - errorlint
    - nakedret
    - nilerr
    - nilnil
    - noctx
    - nolintlint
    - prealloc
    - rowserrcheck
    - sqlclosecheck
    - tenv
    - testableexamples
    - thelper
    - tparallel
    - unconvert
    - wastedassign
linters-settings:
  gci:
    # Section configuration to compare against.
    # Section names are case-insensitive and may contain parameters in ().
    # The default order of sections is `standard > default > project > blank > dot > alias`,
    # If `custom-order` is `true`, it follows the order of `sections` option.
    # Default: ["standard", "default"]
    sections:
      - standard # Standard section: captures all standard packages.
      - default # Default section: contains all imports that could not be matched to another section type.
      - prefix({{ cookiecutter.app_path }}) # Custom section: groups all imports with the specified Prefix.
      - blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
      - dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
      - alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.
    # Skip generated files.
    # Default: true
    skip-generated: false
    # Enable custom order of sections.
    # If `true`, make the section order the same as the order of `sections`.
    # Default: false
    custom-order: true

Go environment

$ go version && go env
go version go1.21.6 linux/amd64
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/hao/.cache/go-build'
GOENV='/home/hao/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/hao/.go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/hao/.go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/hao/.local/share/mise/installs/go/1.21.6/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/hao/.local/share/mise/installs/go/1.21.6/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.6'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/hao/Documents/Projects/foobar/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4235286611=/tmp/go-build -gno-record-gcc-switches'

Verbose output of running

$ go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest cache clean
$ go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run -v
INFO [config_reader] Config search paths: [./ /home/hao/Documents/Projects/foobar /home/hao/Documents/Projects /home/hao/Documents /home/hao /home /]
INFO [config_reader] Used config file .golangci.yml
ERRO [linter] gci: configuration parsing: invalid params: alias
exit status 3

A minimal reproducible example or link to a public repository

// add your code here

Validation

  • Yes, I've included all information above (version, config, etc.).

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependenciesRelates to an upstream dependencyquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions