Proper way to reference files on Linux and Windows

In Go, does Windows require a back slash when referencing files?
For example:
Linux file: /mnt/whatever/filename.ext
Windows: C:\whatever\filename.ext

In Go, even while in Windows, seems like you can reference files with unix style forward slashes? Is that true?

Do you reference the C drive and a folder simply by: “C/whateverfolder”

I realize I can do string(os.PathSeparator), but I’d rather not if I don’t have to.


Any windows version supported by the go runtime allows to use forward slashes.

This is an attribute of modern windows and a languages runtime doesn’t need to do anything special anymore since windows 7 or something…

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.