depguard: add current module name to allow list#4098
Closed
mirecl wants to merge 1 commit intogolangci:masterfrom
mirecl:master
Closed
depguard: add current module name to allow list#4098mirecl wants to merge 1 commit intogolangci:masterfrom mirecl:master
mirecl wants to merge 1 commit intogolangci:masterfrom
mirecl:master
Conversation
|
Hey, thank you for opening your first Pull Request ! |
Author
|
@alexandear @ldez , i'm sure this will be a useful addition, what do you think? |
Member
|
Hello, I think it will create confusion: it's better to let the user create it's own configuration. I will decline this PR. |
Author
|
@ldez, your logic is strange, all will continue to do this setting, add current module to allow list! |
Member
|
An example of a real configuration: depguard:
rules:
main:
deny:
- pkg: "github.com/instana/testify"
desc: not allowed
- pkg: "github.com/pkg/errors"
desc: Should be replaced by standard lib errors packageAs you can see the current module doesn't need to be added. |
Author
|
But if you add at least 1 rule to the allowed list, then the current module becomes prohibited. |
Member
|
Yes because it's the way that depguard v2 works. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AS-IS:
depguard/v2automatic add current module name (from go.mod) in deny list.TO-BE:
depguard/v2automatic add current module name (from go.mod) in allow list.