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┬╣.


Change-Id: I9adfa60e8aa9c6931e3752b24720ec6e77932c9a
Reviewed-by: Alexander Rakoczy <>
Run-TryBot: Alexander Rakoczy <>
TryBot-Result: Gobot Gobot <>
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() {