-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
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 (e.g., gocritic, go vet, etc.). (https://golangci-lint.run/usage/linters/)
Description of the problem
A recent change to the importas
linter broke my linter configuration
Matching duplicate aliases by name ignores the functionality of regex matching
The action exits with exit code 7 which fails the linting action
For example we have the following importas
rules:
- pkg: github.com/aws/aws-sdk-go-v2/service/(\w+)/(\w+)
alias: $1$2
- pkg: github.com/aws/aws-sdk-go-v2/aws/(\w+)/v(\d+)
alias: $1$2
I get the following error: ERRO [linters_context] invalid configuration, multiple packages with the same alias: alias=$1$2 packages=[github.com/aws/aws-sdk-go-v2/aws/(\w+)/v(\d+),github.com/aws/aws-sdk-go-v2/service/(\w+)/(\w+)]
This "duplication" error is entirely meaningless and I have no way of working around it
Version of golangci-lint
$ golangci-lint --version
golangci-lint has version v1.53.0 built with go1.20.4 from (unknown, mod sum: "h1:UigoFKBXwmoJVNWeht27A0jnuZjdOIV4lvMYuA9naj4=") on (unknown)
Configuration file
$ cat .golangci.yml
.go_version: &go_version "1.20"
run:
timeout: 15m
linters:
enable:
- importas
linters-settings:
importas:
no-unaliased: true
alias:
- pkg: github.com/aws/aws-sdk-go-v2/service/(\w+)/(\w+)
alias: $1$2
- pkg: github.com/aws/aws-sdk-go-v2/aws/(\w+)/v(\d+)
alias: $1$2
Go environment
$ go version && go env
go version go1.20.4 darwin/amd64
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
ERRO [linters_context] invalid configuration, multiple packages with the same alias: alias=$1$2 packages=[github.com/aws/aws-sdk-go-v2/aws/(\w+)/v(\d+),github.com/aws/aws-sdk-go-v2/service/(\w+)/(\w+)]
INFO [linters_context/goanalysis] analyzers took 19m19.461633389s with top 10 stages: ... goimports: 13.409366708s, ...
INFO [runner] Issues before processing: 12920, after processing: 0
INFO [runner] Processors filtering stat (out/in): exclude: 5600/5600, autogenerated_exclude: 5600/12920, nolint: 0/97, identifier_marker: 5600/5600, exclude-rules: 97/5600, path_prettifier: 12920/12920, filename_unadjuster: 12920/12920, skip_files: 12920/12920, skip_dirs: 12920/12920, cgo: 12920/12920
INFO [runner] processing took 357.059836ms with stages: ...
INFO [runner] linters took 20.238831117s with stages: goanalysis_metalinter: 19.881639192s
INFO File cache stats: 990 entries of total size 4.3MiB
INFO Memory: 379 samples, avg is 1670.2MB, max is 5625.5MB
INFO Execution took 40.680294672s
make: *** [lint-go] Error 7
Code example or link to a public repository
.go_version: &go_version "1.20"
run:
timeout: 15m
linters:
enable:
- importas
linters-settings:
importas:
no-unaliased: true
alias:
- pkg: github.com/aws/aws-sdk-go-v2/service/(\w+)/(\w+)
alias: $1$2
- pkg: github.com/aws/aws-sdk-go-v2/aws/(\w+)/v(\d+)
alias: $1$2
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working