Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allowed ¶
Allowed is a list of modules and module domains that are allowed to be used.
func (*Allowed) IsAllowedModule ¶
IsAllowedModule returns true if the given module name is in the allowed modules list.
func (*Allowed) IsAllowedModuleDomain ¶
IsAllowedModuleDomain returns true if the given modules domain is in the allowed module domains list.
type Blocked ¶
type Blocked struct {
Modules BlockedModules `yaml:"modules"`
}
Blocked is a list of modules that are blocked and not to be used.
type BlockedModule ¶
type BlockedModule map[string]Recommendations
BlockedModule is a blocked module name and optionally a list of recommended modules and a reason message.
type BlockedModules ¶
type BlockedModules []BlockedModule
BlockedModules a list of blocked modules.
func (BlockedModules) Get ¶
func (b BlockedModules) Get() []string
Get returns the modules that are blocked.
func (BlockedModules) IsBlockedModule ¶
func (b BlockedModules) IsBlockedModule(module string) bool
IsBlockedModule returns true if the given module name is in the blocked modules list.
func (BlockedModules) IsBlockedPackage ¶
func (b BlockedModules) IsBlockedPackage(pkg string) bool
IsBlockedPackage returns true if the package name is in the blocked modules list.
func (BlockedModules) RecommendedModules ¶
func (b BlockedModules) RecommendedModules(pkg string) *Recommendations
RecommendedModules will return a list of recommended modules for the package provided. If there is no recommendation nil will be returned.
type Configuration ¶
Configuration of gomodguard allow and block lists.
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
Processor processes Go files.
func NewProcessor ¶
func NewProcessor(config Configuration, logger *log.Logger) (*Processor, error)
NewProcessor will create a Processor to lint blocked packages.
func (*Processor) ProcessFiles ¶
ProcessFiles takes a string slice with file names (full paths) and lints them.
type Recommendations ¶
type Recommendations struct { Recommendations []string `yaml:"recommendations"` Reason string `yaml:"reason"` }
Recommendations are alternative modules to use and a reason why.
func (*Recommendations) HasRecommendations ¶
func (r *Recommendations) HasRecommendations() bool
HasRecommendations returns true if the blocked package has recommended modules.
func (*Recommendations) IsRecommended ¶ added in v1.0.4
func (r *Recommendations) IsRecommended(pkg string) bool
IsRecommended returns true if the package provided is in the Recommendations list
func (*Recommendations) String ¶
func (r *Recommendations) String() string
String returns the recommended modules and reason message.