// Move, given a package path and a destination package path, will try // to move the given package to the new path. The Move function will // first check for any conflicts preventing the move, such as a // package already existing at the destination package path. If the // move can proceed, it builds an import graph to find all imports of // the packages whose paths need to be renamed. This includes uses of // the subpackages of the package to be moved as those packages will // also need to be moved. It then renames all imports to point to the // new paths, and then moves the packages to their new paths. func Move(ctxt *build.Context, from, to, moveTmpl string) error { … } // srcDir returns the absolute path of the srcdir containing pkg. func srcDir(ctxt *build.Context, pkg string) (string, error) { … } // subpackages returns the set of packages in the given srcDir whose // import path equals to root, or has "root/" as the prefix. func subpackages(ctxt *build.Context, srcDir string, root string) map[string]bool { … } type mover … func (m *mover) checkValid() error { … } // moveCmd produces the version control move command used to move fromDir to toDir by // executing the given template. func moveCmd(moveTmpl, fromDir, toDir string) (string, error) { … } func (m *mover) move() error { … } // sameLine reports whether two positions in the same file are on the same line. func sameLine(fset *token.FileSet, x, y token.Pos) bool { … } var moveDirectory …