Open Snowman7785 opened 1 year ago
💯 I'm running into this non-deterministic behavior as well.
I'm using this via https://golangci-lint.run and have a configuration like
importas:
alias:
- pkg: github.com/go-kit/log
alias: kitlog
- pkg: github.com/foo/bar/scheduler/(v[\w\d]+)
alias: sched$1
- pkg: github.com/foo/bar.*/(\w+)/(v[\w\d]+)
alias: $1$2
unfortunately I randomly see errors like
grpcclient/clients_scheduler.go:8:2: import "github.com/foo/bar/scheduler/v1" imported as "schedv1" but must be "schedulerv1" according to config (importas)
schedv1 "github.com/foo/bar/scheduler/v1"
In these cases, the last rule in the order is taking precedence, when my intention was for the first rule to match and take precedence.
thanks!
Would it be possible to get the order of the rules respected internally? With the rules being put into a map, the order is different from run to run. When utilizing the regexp rules, it would be helpful to be able to rely on the order so you can get progressively broader in the rules.