archp

package module
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: MIT Imports: 3 Imported by: 0

README

Package archp

GoDoc License

achp enforce architectural rules as errors values or unit tests

It has the following features:

  • Validate pkgs imports as dependencies.
  • Handles custom errs for each architecture policy

Installation

Use go get.

go get github.com/gpbPiazza/archp

Then import the archp package into your own code.

import "github.com/gpbPiazza/archp"

Usage and documentation

Please see https://pkg.go.dev/github.com/gpbPiazza/archp/ for detailed usage docs.

Examples:

Disclaimers

Special Notes:

1 .archp depends totally on go/build package to work, so if your package under test is not in a remote repository it will always return err in the build.Import function. 2. This first version doesn't support validate a package children packages imports, for example:

-- domain
        |-- services
        |        |-- service.go
        |-- models
        |        |-- model.go

The analysis under domain package is not supported to validate if the service.go file or model.go are following the expected rules.

Future features:
  • solve the especial notes 2. Packages analysis to nested packages dependencies.
  • options to use t *testing.T

License

Distributed under MIT License, please see license file within the code for more details.

Maintainers

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrImport is the base err to any err returned from the go/build pkg.
	// Use ErrImport to assert against go/Build errs.
	ErrImport = errors.New("failed to import package")
)

Functions

This section is empty.

Types

type PKGAnalizer

type PKGAnalizer struct {
	// contains filtered or unexported fields
}

func NewPKGAnalizer

func NewPKGAnalizer(importPath string) *PKGAnalizer

func (*PKGAnalizer) Analize

func (pkg *PKGAnalizer) Analize() error

func (*PKGAnalizer) DisallowedDependOn

func (pkg *PKGAnalizer) DisallowedDependOn(importPath string) *PKGAnalizer

type PolicyError

type PolicyError struct {
	TargetAnalized string
	Policy         string
	TriggerErr     string
}

func (*PolicyError) Error

func (pe *PolicyError) Error() string

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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