Now this is problematic because in some system setups, execution is not allowed within a temporary dir.
Thank you for the prompt reply, Andrew.
Replying just to you, to not to pollute golang-dev :)
I'm on Win7 x64, go 1.2.1 and setting TMPDIR didn't help.
`go test -work` still displays the standard windows system temp dir and creates temporary test executable there.
On Apr 30, 2014 12:52 PM, "Andrew Gerrand" <a...@golang.org> wrote:
>
> +golang-dev (keep it on list because I know nothing about windows)
>
> On 30 April 2014 12:47, Zura Khetsuriani <zura.khe...@gmail.com> wrote:
>>
>> Thank you for the prompt reply, Andrew.
>>
>> Replying just to you, to not to pollute golang-dev :)
>>
>> I'm on Win7 x64, go 1.2.1 and setting TMPDIR didn't help.
>> `go test -work` still displays the standard windows system temp dir and creates temporary test executable there.
>
> Right, TMPDIR is not a thing on Windows.
i think it's TEMP on windows.
The GetTempPath function checks for the existence of environment variables in the following order and uses the first path found:
Note that the function does not verify that the path exists, nor does it test to see if the current process has any kind of access rights to the path.
Right, it is for setting a system temporary directory on Windows. But,
what I originally meant is that to be able to specify some custom
directory to `go test` in particular, independently from system temp dir.
echo %temp%
C:\Users\xxxyyy\AppData\Local\TempKasperky was giving me problems until I set GOTMPDIR to a directory that could be included as an exception. The problem is that if GOTMPDIR is not set, golang will sometimes build in that generic \Temp directory tied to your users profile that is dangerous to allow as a generic exception to Kaspersky. And for me, Kaspersky doesn't allow wildcards in the directory exceptions like Avast can.
Assuming you've already added your GOPATH as an exception in your antivirus (for example, "C:\Users<user>\go"...what worked for me was to...
add a new directory (I named mine "tmp" but you could probably name it a number of things) within that path, i.e., "C:\Users<user>\go\tmp"
Set the golang environment variable GOTMPDIR to it...
> go env -w GOTMPDIR="C:\Users<user>\go\tmp"
And the issue goes away. But note that I already added "C:\Users<user>\go" as an exception to my antivirus.
Window 10, GO 1.17, and Kaspersky