Closed Creatone closed 9 months ago
Can you post your config as well (Just the depguard one).
The following is where the panic occured, but ioc
is package in your config. This can only be -1 if length of ioc
is 0 meaning it was an empty string.
depguard:
rules:
Main:
files:
- $all
- "!$test"
allow:
- $gostd
- github.com/sirupsen/logrus
- github.com/streadway/amqp
- github.com/rabbitmq/amqp091-go
deny:
reflect: Please don't use reflect package
Test:
files:
- $test
allow:
- $gostd
- github.com/stretchr/testify
deny:
reflect: Please don't use reflect package
@Creatone thanks! I will take a look as soon as I can. I can't see anything wrong with the configs right off the top of my head.
@Creatone using your configurations and running against depguard repository (the tagged v2.1.0), I am unable to reproduce the panic.
Is there a repository I can reproduce your configuration against? What OS are you running? Any other bit of information like, did it work partially for some packages but not all packages.
I was able to reproduce this bug and find a workaround.
The problem lies within golangci-run
, which expects a deny list, because golangci.yml keys can't have a dot (viper limitation)
deny:
- pkg: "github.com/sirupsen/logrus"
desc: not allowed
- pkg: "github.com/pkg/errors"
desc: Should be replaced by standard lib errors package
Whereas the config for depguard standalone is a deny map:
deny:
reflect: Please don't use reflect package
BTW the last README example uses a list syntax:
Main:
deny:
- github.com/OpenPeeDeeP/depguard$
I propose to add a comment to the golangci documentation: https://github.com/golangci/golangci-lint/pull/4227
Since the maintainer of golangci refuses to draw attention to this discrepancy, it might be wise to add it to your README.
@oliverpool thaaanks @dixonwille it's working now :)
Since the maintainer of golangci refuses to draw attention to this discrepancy, it might be wise to add it to your README.
Sounds good to me.
Got this using golangci-lint
v1.55.1