Skip to content
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

Add current module name to allow list #66

Open
mirecl opened this issue Sep 21, 2023 · 3 comments
Open

Add current module name to allow list #66

mirecl opened this issue Sep 21, 2023 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@mirecl
Copy link

mirecl commented Sep 21, 2023

More info in PR for golangci/golangci-lint#4098

@dixonwille
Copy link
Member

I like the idea of being explicit over implicit. I agree with Idez in this scenario, magic configs cropping up is not good. The reason why go.mod is allowed when no allow list is supplied is because this package assumed without an allow everything was allowed. Once you specified allowed, it went into a strict mode situation where everything is denied.

I just recently pushed a change to V2 that lets you determine the mode Strict vs Lax. I have not tagged it yet as I am trying to cleanup a few Issues before I do.

I can compromise by adding a $gomodname variable, but I don't see what that gives you outside of just putting it in the list (maybe the ability to reuse configs by module).

@dixonwille dixonwille added this to the v2.2.0 milestone Oct 31, 2023
@dixonwille
Copy link
Member

I am going to add the $gomodname variable in as I have a few other issues that require additional variables. That will be in the v2.2.0 release

@dixonwille dixonwille added the enhancement New feature or request label Oct 31, 2023
@ldemailly
Copy link

I'll second that having depguard on for a package with 0 dependency yet getting

env_test.go:9:2: import 'fortio.org/struct2env' is not allowed from list 'Main' (depguard)
	"fortio.org/struct2env"
	^

when that's the module path is weird

the default config should at least work for "0 dep" packages where 0 deps still means the test package can test the module

ldemailly added a commit to fortio/struct2env that referenced this issue Nov 5, 2023
ldemailly added a commit to fortio/struct2env that referenced this issue Nov 5, 2023
* adding files from fortio/dflag#50 where this was initially done

* update package path

* update test to use canonical package name, add to readme

* adding workflows

* refactor/inline some type conversion and start returning error lists instead of logging. also testing that linter ci should fail

* fix lints

* removed dependency on assert and log, 0 dependencies now

* add back depguard - yet OpenPeeDeeP/depguard#66. add note about go version(s)
@dixonwille dixonwille modified the milestones: v2.2.0, v2.3.0 Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants