importas: config seems to get sorted before execution
grosser opened this issue · 2 comments
Welcome
- Yes, I understand that the GitHub action repository is not the repository of golangci-lint itself.
- Yes, I've searched similar issues on GitHub and didn't find any.
- Yes, I've included all information below (version, config, etc).
Description of the problem
I'm using import amissionv1 "k8s.io/api/admissionregistration/v1/admissionregistration/v1"
and locally it does not complain, but when running CI it does
so I looks like the config is getting sorted/shuffled before execution somehow
Version of golangci-lint
v1.60.3
Version of the GitHub Action
4
Workflow file
lint:
name: make lint
runs-on: [self-hosted, zendesk-stable]
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v5
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.60.3
skip-go-installation: true
working-directory: workload-migrationGolangci-lint configuration
linters:
disable-all: true
enable:
- importas
linters-settings:
importas:
alias:
- pkg: k8s.io/api/admissionregistration/v1
alias: admissionv1
- pkg: k8s.io/api/(\w+)/(v\d+\w*)
alias: "$1$2"Go version
1.22.2
Code example or link to a public repository
import amissionv1 "k8s.io/api/admissionregistration/v1/admissionregistration/v1"Hello,
the importas configuration is a slice, so there is no sort.
But, the configuration is set to the linter through the flags, and those flags are stored inside a map.
https://github.com/julz/importas/blob/b8654f969a5f5c63b119cadb1d310322a9d08d00/flags.go#L14
https://github.com/julz/importas/blob/b8654f969a5f5c63b119cadb1d310322a9d08d00/flags.go#L20
https://github.com/julz/importas/blob/b8654f969a5f5c63b119cadb1d310322a9d08d00/config.go#L11
So the problem is not inside golangci-lint but inside importas.
thx. made a fix PR :)