Skip to content

Commit 2555088

Browse files
authored
Set GOTMPDIR to a child directory (#4183)
So, Windows does not detect temporary Go binaries (e.g. magefile) as a virus. This solves: ``` failed to run compiled magefile: fork/exec C:\Users\windows\magefile\6e561802bbe21387b05a72ec1f51afbf0b1d8e8d.exe: Operation did not complete successfully because the file contains a virus or potentially unwanted software. ```
1 parent 84e6bc1 commit 2555088

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

.buildkite/hooks/pre-command.ps1

+4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ go version
1414

1515
$GOPATH = $(go env GOPATH)
1616
$env:Path = "$GOPATH\bin;" + $env:Path
17+
$env:GOTMPDIR = "$GOPATH\tmp"
18+
New-Item -ItemType Directory -Force -Path $env:GOTMPDIR
1719
[Environment]::SetEnvironmentVariable("GOPATH", "$GOPATH", [EnvironmentVariableTarget]::Machine)
20+
[Environment]::SetEnvironmentVariable("GOTMPDIR", "$GOPATH\tmp", [EnvironmentVariableTarget]::Machine)
1821
[Environment]::SetEnvironmentVariable("Path", "$GOPATH\bin;$env:Path", [EnvironmentVariableTarget]::Machine)
22+
go env
1923

2024
# Install tools
2125
go install github.com/magefile/mage

0 commit comments

Comments
 (0)