I am using the Go race detector on Windows and would like the detected races to be logged to a file rather than to stderr. This is possible by setting the GORACE
environment variable:
$ GORACE='log_path=/var/reports/myprogram' ./myprogram
However, when trying it on Windows my program writes an error to stderr and immediately exits:
PS C:\foo> $env:GORACE = 'log_path=C:\RaceReports\myprogram'
PS C:\foo> .\myprogram.exe
ERROR: expected '='
PS C:\foo>
It works fine if I don't use absolute paths:
PS C:\foo> $env:GORACE = 'log_path=myprogram'
PS C:\foo> .\myprogram.exe
PS C:\foo> ls
Directory: C:\foo
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 15/11/2017 17:17 581 myprogram.7904
-a---- 15/11/2017 16:55 2599936 myprogram.exe
PS C:\foo>
Am I doing something wrong? Is this a bug in Go? Any help is much appreciated.