Documentation
¶
Overview ¶
Package importclosure finds every package of a module that a package is built from, for the guards that pin what that code may use.
A guard that scans one directory pins nothing about the packages that directory imports: code that moves into one of them leaves the guard's reach and no test fails. The purity guards of sdk/go/helpers and sdk/go/core therefore scan every package of the module their package imports, directly or through another, as Walk computes it.
It is test support, imported only by _test.go files. Like vectorio it takes no *testing.T and returns errors instead of failing, because a non-test package that imports testing registers the -test.* flags on every binary that links it. It reads import specs with go/parser rather than running the go command, so a guard needs nothing but the source tree.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ModulePath ¶
ModulePath reads the module path from the go.mod file in root.
func SourceFiles ¶
SourceFiles returns the paths of the non-test Go files in dir, in name order.
func Walk ¶
Walk returns the directory of start and of every package of module that start imports, directly or through another, keyed by import path. root is the module's root directory: an import path module+"/x/y" lives in root/x/y.
Only the imports of non-test files count, so a package that a test alone imports is not part of the closure. A package of the module whose directory is missing or holds no non-test Go file is an error, so an import path mapped wrongly cannot shrink the closure without a failure.
Types ¶
This section is empty.