// SetupTestGoRoot sets up a temporary GOROOT for use with script test // execution. It copies the existing goroot bin and pkg dirs using // symlinks (if possible) or raw copying. Return value is the path to // the newly created testgoroot dir. func SetupTestGoRoot(t *testing.T, tmpdir string, goroot string) string { … } // ReplaceGoToolInTestGoRoot replaces the go tool binary toolname with // an alternate executable newtoolpath within a test GOROOT directory // previously created by SetupTestGoRoot. func ReplaceGoToolInTestGoRoot(t *testing.T, testgoroot, toolname, newtoolpath string) { … } // linkOrCopy creates a link to src at dst, or if the symlink fails // (platform doesn't support) then copies src to dst. func linkOrCopy(t *testing.T, src, dst string) { … }