Re: [go-nuts] Changing the go run -work folder to a different root

379 views
Skip to first unread message

Kyle Lemons

unread,
Sep 18, 2012, 4:22:43 PM9/18/12
to Tallal Garghouti, golan...@googlegroups.com
Go build uses ioutil.TempDir (http://golang.org/src/cmd/go/build.go#L330) which uses os.TempDir which, on linux, refers to the environment variable TMPDIR.  So, set that and you're golden :).

On Tue, Sep 18, 2012 at 6:55 AM, Tallal Garghouti <tal...@gmail.com> wrote:
Hi,

I've tried to find this in the docs but have not come up with anything so here goes...

My antivirus [f-secure] blocks any attempts to use the convention "go run foobar.go" in development. It does this by denying access to the a.out.exe that gets produced behind the scenes in the WORK directory.

So to get around this annoyance I'd like to point this WORK directory to a different TEMP location that I can then safely exclude in the antivirus settings.

Anyone got any ideas?

Thanks in advance,
Tallal

--
 
 

Tallal Garghouti

unread,
Sep 18, 2012, 4:32:20 PM9/18/12
to golan...@googlegroups.com, Tallal Garghouti
Thanks for the suggestion .. I should have mentioned that I'm on windows.

Setting TMPDIR as an env var in windows has no effect. It's still picking up the system TMP which is what I'm trying to override.

Kyle Lemons

unread,
Sep 18, 2012, 4:41:42 PM9/18/12
to Tallal Garghouti, golan...@googlegroups.com
On Tue, Sep 18, 2012 at 1:32 PM, Tallal Garghouti <tal...@gmail.com> wrote:
Thanks for the suggestion .. I should have mentioned that I'm on windows.

Setting TMPDIR as an env var in windows has no effect. It's still picking up the system TMP which is what I'm trying to override.

I gave you a pretty thorough blow-by-blow of how I looked it up on linux.  Repeat the process (starting with os.TempDir) on Windows, and see how it figures out the directory :).

(hint: it will lead you here)
 

On Tuesday, 18 September 2012 21:23:10 UTC+1, Kyle Lemons wrote:
Go build uses ioutil.TempDir (http://golang.org/src/cmd/go/build.go#L330) which uses os.TempDir which, on linux, refers to the environment variable TMPDIR.  So, set that and you're golden :).

On Tue, Sep 18, 2012 at 6:55 AM, Tallal Garghouti <tal...@gmail.com> wrote:
Hi,

I've tried to find this in the docs but have not come up with anything so here goes...

My antivirus [f-secure] blocks any attempts to use the convention "go run foobar.go" in development. It does this by denying access to the a.out.exe that gets produced behind the scenes in the WORK directory.

So to get around this annoyance I'd like to point this WORK directory to a different TEMP location that I can then safely exclude in the antivirus settings.

Anyone got any ideas?

Thanks in advance,
Tallal

--
 
 

--
 
 

Tallal Garghouti

unread,
Sep 18, 2012, 4:47:18 PM9/18/12
to golan...@googlegroups.com, Tallal Garghouti
Ok I got a workaround thanks to your tips.

I set TMP to a build folder that is pre-excluded from virus scanning, them "go run" method works fine. I guess I'll just have to remember to set it at the beginning of each session.

Cheers!

Dave Cheney

unread,
Sep 18, 2012, 4:52:34 PM9/18/12
to Tallal Garghouti, golan...@googlegroups.com
> I set TMP to a build folder that is pre-excluded from virus scanning, them
> "go run" method works fine. I guess I'll just have to remember to set it at
> the beginning of each session.

I'm positive you can set environment variables for your login.
Reply all
Reply to author
Forward
0 new messages