OpenPeeDeeP / depguard

Go linter that checks if package imports are in a list of acceptable packages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how is this different from looking into go.mod?

nikolaydubina opened this issue · comments

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.