pkgforbid

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2023 License: MIT Imports: 7 Imported by: 0

README

pkgforbid

pkgforbid is a linter for checking if a package imports a particular package.

Use cases

If you want to prohibit dependencies on internal packages
graph TD

domain --> repository
If you want to prohibit dependencies on standard libralies
graph TD

domain --> net/http
If you want to prohibit dependencies on standard libralies via internal packages
graph TD

domain --> util --> net/http

How to run

pkgforbid --config=pkgforbid.yaml ./...
Config file
packageConfigs:
  "github.com/foo/bar/domain":
    forbiddenPackages:
      - net/http
      - database/sql
      - gorm.io/gorm
      - github.com/foo/bar/repository
  "github.com/foo/bar/service":
    forbiddenPackages:
      - github.com/foo/bar/repository
debug: false

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfigFile *string

	Dependencies map[string]map[string]bool

	Analyzer = &analysis.Analyzer{
		Name: "pkgforbid",
		Doc:  "pkgforbid",
		Run:  run,
	}
)

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL