OpenPeeDeeP / depguard

Go linter that checks if package imports are in a list of acceptable packages.
GNU General Public License v3.0
138 stars 15 forks source link

how is this different from looking into go.mod? #76

Closed nikolaydubina closed 10 months ago

dixonwille commented 10 months ago

This package allows you to define that certain files/folders can/cannot contain packages. If a simple go.mod lookup works for your needs look at https://github.com/ryancurrah/gomodguard.

For example, I may have a module that has many packages. I can say package A cannot use the reflect package in stdlib as my module has all the reflect logic in package B. I can also say that testify should only be in _test.go files.

This was originally written before go.mod was introduced and I had a mono repository of services. I didn't want certain services to import certain packages without first being vetted.