-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: depguard v1 default behavior #49
Comments
+1 |
According to the following links, the linter "ran" but did absolutely nothing. https://github.com/golangci/golangci-lint/blob/da04413a8a1eefb8c10161c9f2b558138d01815c/pkg/golinters/depguard.go#L191 But according to https://golangci-lint.run/usage/linters/ depguard isn't enabled by default. So I assume you must have enabled it not realizing that it did nothing without configuring it. Now, if enabled, the default behavior is to only allow Golang Standard Library. I suggest either disabling it in golangci-lint or configure it according to https://github.com/golangci/golangci-lint/blob/68be5babba5cde7cde558e87fb993b484cd48cc0/.golangci.reference.yml#LL173C1-L205C68 |
Thank you @dixonwille for the response. I didn't realise, that linter was enabled and doing nothing. |
depguard v1 worked great for catching use of blacklisted packages; going to have to disable it now since listing every single internal (!) and external package is way too cumbersome. |
Have you tried removing the AllowList (if nothing in allow, assumes all packages are fine) then just adding the packages you don't want to the DenyList. Also, |
@dixonwille Here's the relevant section from my linters-settings:
depguard:
deny:
- pkg: encoding/json
desc: "use pkg/json" Also, path prefixing doesn't seem to work, need to specify the full package names. linters-settings:
depguard:
allow:
- github.com/foo/bar/ # doesn't allow github.com/foo/bar/baz Could be a problem with the golangci-lint integration, too. |
I'll check into it Just so I am clear though, there appears to be a few levels missing in your yaml ( |
Oh, my bad, works as expected after adding the missing levels 🫢 |
Hi
I recently updated golangci-lint to
v1.53.0
and it seems to get latest depguard v2.Before I was running depguard without any config, however now I need to explicitly list all allowed packages in order to pass the lint.
I would like to ask what was the previous behavior of depguard in version v1 without config?
The text was updated successfully, but these errors were encountered: