For creating and manipulating OS-specific paths directly use os.PathSeparator and the path/filepath package.
An alternative method is to always use "https://stackoverflow.com/" and the path package throughout your program. The path package uses "https://stackoverflow.com/" as path separator irrespective of the OS. Before opening or creating a file, convert the /-separated path into an OS-specific path string by calling filepath.FromSlash(path string). Paths returned by the OS can be converted to /-separated paths by calling filepath.ToSlash(path string).