truss icon indicating copy to clipboard operation
truss copied to clipboard

Output path arguments should be conformed with `filepath.ToSlash`

Open pauln opened this issue 8 years ago • 1 comments

In order to prevent mishaps (especially on Windows), it'd be best to run the --pbout and --svcout arguments through filepath.ToSlash (once they've been found to be non-empty) in order to ensure that all slashes are in the correct direction (/ rather than \). Accidentally providing Windows-style slashes currently results in warnings such as:

?[33mWARN?[0m[0000] Code formatting error, generated service will not build, outputting unformatted code  ?[33merror?[0m=26:20: unknown escape sequence (and 2 more errors)

This is because you end up with mixed-slashes imports (foo\bar\baz/foobar/barbaz) in the generated Go code, which Go (understandably) doesn't like.

pauln avatar Jul 24 '17 04:07 pauln

This would also mean that the File Placement section of TUTORIAL.md could be simplified to say that the paths are relative to your GOROOT.

pauln avatar Jul 24 '17 05:07 pauln