Your problem is probably that backslashes in normal strings are escape sequences. There are raw strings delimited by backticks that are easier to use with backslashes. The following string constants are equal:
"D:\\myfolder\\file.txt"
`D:\myfolder\file.txt`
while "D:\myfolder\file.txt" contains the escape sequences \m and \f, where I’m not sure if any of them mean anything useful but they might mean something, leaving you with control characters in the file name. Even if they aren’t parsed as control sequences they might get parsed to themselves, \m meaning a literal m and leaving your path entirely without slashes.
This gives you a string with a newline at the end, which is not valid for the file name. You can strip the newline or use a bufio.Scanner. (And please try to use the code formatting function in the forum when pasting code, it makes it easier to read and copy/paste.)
Golang uses forward slashes when using paths. ‘/’ that. So if your taking the path in from the user make sure to replace all backward slashes with forward ones
Go is perfectly fine with backslashes as path separators on Windows, although Windows is also fine with forward slashes. If you do need to convert at some point, filepath.ToSlash and filepath.FromSlash will do the right thing for the platform you’re on.