godependencies

package
v0.0.0-...-d6705c8 Latest Latest
Warning

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

Go to latest
Published: May 15, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxImportDepth is default value for max depths during recursive import of dependency
	MaxImportDepth = 404
)

Variables

View Source
var (
	// AlwaysIgnored is set of ignored strings
	AlwaysIgnored = []*regexp.Regexp{

		regexp.MustCompile("^[^/]+/?$"),

		regexp.MustCompile("^[^/]+/[^/]+/?$"),
	}
)

Functions

func FSDepImports

func FSDepImports(sourcefs filesystem.Filespace) (imports []string, err error)

FSDepImports return list of all golang imports in filespace. It find all *.go files to find imports.

func FSDirImports

func FSDirImports(sourcefs filesystem.Filespace) (imports []string, err error)

FSDirImports return list of all golang imports in root directory. It find all *.go files to find imports.

func FindImports

func FindImports(code string) (imports []string, err error)

FindImports return all imports paths from golang code

func IsIgnoredPath

func IsIgnoredPath(coll []*regexp.Regexp, path string) bool

IsIgnoredPath return true if path is ignored

func MatchGoSrcRelativePath

func MatchGoSrcRelativePath(GOPath, cwd string) (result string, err error)

MatchGoSrcRelativePath match path relative to GOPATH

Types

type Importer

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

Importer is class contains logic of import go packages

func NewImporter

func NewImporter(projectPath string, logs ImporterLogs, options ImporterOptions, dependencies gcliservices.DependenciesService) (importer *Importer, err error)

NewImporter create new Importer instance

func (*Importer) Import

func (importer *Importer) Import() (err error)

Import load all dependencies recursively

func (*Importer) WriteDef

func (importer *Importer) WriteDef() (err error)

WriteDef save import result to definitions

type ImporterLogs

type ImporterLogs struct {
	GOPath      func(path string)
	OnNewSource func(path string)
}

ImporterLogs is struct contains logs callbacks

type ImporterOptions

type ImporterOptions struct {
	MaxDep  int
	DevLogs bool
}

ImporterOptions is set of importer options

type ImporterPath

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

ImporterPath is path contains relative and absolute paths to the same directory

type Set

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

Set is a class accumulate golang imports

func NewSet

func NewSet() *Set

NewSet create new Set instance

func (*Set) Add

func (set *Set) Add(dependencies []*config.Dependency) (err error)

Add append dependencies to accumulator

func (*Set) Dependencies

func (set *Set) Dependencies() (result []*config.Dependency)

Dependencies return all dependencies config data

func (*Set) Resolve

func (set *Set) Resolve(gopath string) bool

Resolve return status for path. True for resolved path or false for unresolved

func (*Set) Row

func (set *Set) Row(destPath string) (result *SetRow)

Row return single dependency row by path

func (*Set) SetResolve

func (set *Set) SetResolve(gopath string, status bool)

SetResolve set status for path

type SetRow

type SetRow struct {
	Dependency *config.Dependency
	Imported   bool
}

SetRow is single record in Set

func (*SetRow) SetImported

func (row *SetRow) SetImported(value bool)

SetImported update imported value

Jump to

Keyboard shortcuts

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