You can move a directory in Go by using the os.Rename() function which can be used to rename or move a file or directory in the file system.
The os.Rename() function takes two arguments, the current path of the file/directory and the new path of the file/directory. Here is an example usage to move a directory:
main.go414 chars21 linesNote that when moving a directory, the new path must not exist already. If it does, an error will be returned.
gistlibby LogSnag