os.Chdir() in golang is not working properly.
package main
import (
"fmt"
"os"
)
func main() {
command := "cd C:\\"
if err := os.Chdir(command[3:]); err != nil {
fmt.Println("Error:\tCould not move into the directory (%s)\n")
}
}
Outputs:
Error: Could not move into the directory
Am I doing something wrong or missing something?