That's a good question.

The contents of the import declaration are defined to be implementation 
dependent by the spec

> The interpretation of the ImportPath is implementation-dependent but it 
is typically a substring of the full file name of the compiled package and 
may be relative to a repository of installed packages.

It also goes on to say

> Implementation restriction: A compiler may restrict ImportPaths to 
non-empty strings using only characters belonging to Unicode's 
<http://www.unicode.org/versions/Unicode6.3.0/> L, M, N, P, and S general 
categories (the Graphic characters without spaces) and may also exclude the 
characters !"#$%&'()*,:;<=>?[\]^`{|} and the Unicode replacement character 
U+FFFD.

Suggesting that some implementations may exclude backslash.

In practice gc and gccgo treat the import path as a directory path, and 
while windows can cope with forward slashes, non windows operating systems 
cannot cope with backslash. So for simplicities sake, i'd say you should 
treat the import path like a path in a url--forward slashes only.

On Saturday, 11 November 2017 05:31:37 UTC+11, Tim Hockin wrote:
>
> Is it valid to say `import "github.com\foo\bar" (windows path 
> separators) or must it be "github.com/foo/bar"?  I couldn't find a 
> canonical answer to this. 
>
> Thanks 
>
> Tim 
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to