// TestAllDependencies ensures dependencies of all // modules in GOROOT are in a consistent state. // // In short mode, it does a limited quick check and stops there. // In long mode, it also makes a copy of the entire GOROOT tree // and requires network access to perform more thorough checks. // Keep this distinction in mind when adding new checks. // // See issues 36852, 41409, and 43687. // (Also see golang.org/issue/27348.) func TestAllDependencies(t *testing.T) { … } // packagePattern returns a package pattern that matches all packages // in the module modulePath, and ideally as few others as possible. func packagePattern(modulePath string) string { … } // makeGOROOTCopy makes a temporary copy of the current GOROOT tree. // The goal is to allow the calling test t to safely mutate a GOROOT // copy without also modifying the original GOROOT. // // It copies the entire tree as is, with the exception of the GOROOT/.git // directory, which is skipped, and the GOROOT/{bin,pkg} directories, // which are symlinked. This is done for speed, since a GOROOT tree is // functional without being in a Git repository, and bin and pkg are // deemed safe to share for the purpose of the TestAllDependencies test. func makeGOROOTCopy(t *testing.T) string { … } type runner … // run runs the command and requires that it succeeds. func (r runner) run(t *testing.T, args ...string) { … } // TestDependencyVersionsConsistent verifies that each module in GOROOT that // requires a given external dependency requires the same version of that // dependency. // // This property allows us to maintain a single release branch of each such // dependency, minimizing the number of backports needed to pull in critical // fixes. It also ensures that any bug detected and fixed in one GOROOT module // (such as "std") is fixed in all other modules (such as "cmd") as well. func TestDependencyVersionsConsistent(t *testing.T) { … } type gorootModule … // findGorootModules returns the list of modules found in the GOROOT source tree. func findGorootModules(t *testing.T) []gorootModule { … } var goroot …