Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ImportReport ¶
type ImportReport struct { Imports []ImportReportPkg `json:"imports"` MainOnlyImports []ImportReportPkg `json:"mainOnlyImports"` TestOnlyImports []ImportReportPkg `json:"testOnlyImports"` }
func CreateImportReport ¶
func CreateImportReport(rootDir string) (ImportReport, error)
type ImportReportPkg ¶
type ImportReportPkg struct { // path for the package Path string `json:"path"` // number of Go files in the package NGoFiles int `json:"numGoFiles"` // number of Go files imported by this package (does not include files in package itself) NImportedGoFiles int `json:"numImportedGoFiles"` // package path of the packages that import this package ImportSrc []string `json:"importedFrom"` }
type PkgInfo ¶
type PkgInfo struct { // import path for package ("_test" is appended if the package represents the tests files) Path string // name of package Name string // number of .go files in the package directory NGoFiles int // importPath of all of the packages imported by the package. If usage information was retrieved, the value is // a set that contains the files in the package that imported the package; otherwise, it is nil. Imports map[string]map[string]struct{} }
func DirPkgInfo ¶
DirPkgInfo returns a PkgInfo for the package in the specified srcDir using the specified mode. If the mode is Default, the package information is that of the non-test files in the package, while if it is Test, it is the information for the test files (internal and external) in the package. The package information is obtained by running a local import (".") for the package from its own directory. If the mode is Test, the path of the returned package will have "_test" appended to it to differentiate it from the non-test package.
func ImportPkgInfo ¶
ImportPkgInfo returns a PkgInfo for the package specified by importPkgPath imported from srcPkgDir using the specified mode. If the mode is Default, the package information is that of the non-test files in the package, while if it is Test, it is the information for the test files (internal and external) in the package. The package information is obtained by running an import for importPkgPath from the srcPkgDir directory, which is equivalent to an import statement `import "importPkgPath"` in a package located in srcPkgDir. If the package resolved from that location is a vendored package, the path will be the vendored import path. If the mode is Test, the path of the returned package will have "_test" appended to it to differentiate it from the non-test package.
type ProjectGoFileCounter ¶
type ProjectGoFileCounter interface { NGoFiles(pkg string) (int, bool) NTotalGoFiles(pkg string) (int, bool) }
func NewProjectGoFileCounter ¶
func NewProjectGoFileCounter(p ProjectPkgInfoer) (ProjectGoFileCounter, error)
type ProjectPkgInfoer ¶
type ProjectPkgInfoer interface { RootDirImportPath() string PkgInfo(pkg string) (PkgInfo, bool) PkgInfos() PkgInfos }
func NewProjectPkgInfoer ¶
func NewProjectPkgInfoer(rootDir string) (ProjectPkgInfoer, error)