Documentation ¶
Index ¶
- Constants
- Variables
- func FSDepImports(sourcefs filesystem.Filespace) (imports []string, err error)
- func FSDirImports(sourcefs filesystem.Filespace) (imports []string, err error)
- func FindImports(code string) (imports []string, err error)
- func IsIgnoredPath(coll []*regexp.Regexp, path string) bool
- func MatchGoSrcRelativePath(GOPath, cwd string) (result string, err error)
- type Importer
- type ImporterLogs
- type ImporterOptions
- type ImporterPath
- type Set
- type SetRow
Constants ¶
const (
// MaxImportDepth is default value for max depths during recursive import of dependency
MaxImportDepth = 404
)
Variables ¶
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 ¶
FindImports return all imports paths from golang code
func IsIgnoredPath ¶
IsIgnoredPath return true if path is ignored
func MatchGoSrcRelativePath ¶
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
type ImporterLogs ¶
ImporterLogs is struct contains logs callbacks
type ImporterOptions ¶
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 (*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 ¶
Resolve return status for path. True for resolved path or false for unresolved
func (*Set) SetResolve ¶
SetResolve set status for path
type SetRow ¶
type SetRow struct { Dependency *config.Dependency Imported bool }
SetRow is single record in Set
func (*SetRow) SetImported ¶
SetImported update imported value