Go generally does a good job of manipulating paths in an OS-agnostic way. However, there is one case where Go may use the wrong path syntax: UNIX-like contexts at runtime on Windows hosts, including cygwin, MSYS, Git Bash, MinGW, and bash on Ubuntu on Windows AKA Windows Linux Subsystem shells. When a Go application runs within these contexts, paths should be manipulated according to cygwin conventions.
For example, the path separator should be /
here, not \
. Also, the root path should be /
, not C:\
.
Could future versions of Go integrate better with cygwin-like environments? Note that the presence/absence of an MSYSTEM
environment variable is a reasonably reliable indicator of a cygwin/non-cygwin environment.