cmd/golangorg: set GOPATH to empty directory rather than empty string

When generating an index, point the GOPATH environment variable to
an empty directory. Setting it to the empty string doesn't work as
of Go 1.8, where a default GOPATH value was added┬╣.

┬╣ https://golang.org/doc/go1.8#gopath

Change-Id: I9adfa60e8aa9c6931e3752b24720ec6e77932c9a
Reviewed-on: https://go-review.googlesource.com/c/website/+/221105
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/cmd/golangorg/generate-index.bash b/cmd/golangorg/generate-index.bash
index 70c9166..ee0857a 100755
--- a/cmd/golangorg/generate-index.bash
+++ b/cmd/golangorg/generate-index.bash
@@ -50,8 +50,8 @@
 makeIndexfile() {
 	echo "*** make $INDEXFILE"
 	golangorg=$(go env GOPATH)/bin/golangorg
-	# NOTE: run golangorg without GOPATH set. Otherwise third-party packages will end up in the index.
-	GOPATH= $golangorg -write_index -goroot goroot -index_files=$INDEXFILE -zip=$ZIPFILE
+	# Run golangorg with GOPATH set to an empty directory, otherwise third-party packages will be in the index.
+	GOPATH=$(mktemp -d) $golangorg -write_index -goroot goroot -index_files=$INDEXFILE -zip=$ZIPFILE
 }
 
 splitIndexfile() {