go.benchmark/garbage: fix garbage benchmark after pkg move

Second attempt to fix the benchmark so that it works for revisions pre and post the pkg move.

LGTM=dvyukov
R=golang-codereviews, gobot, dvyukov
CC=golang-codereviews
https://golang.org/cl/135690043
diff --git a/garbage/garbage.go b/garbage/garbage.go
index 816adb5..571cd36 100644
--- a/garbage/garbage.go
+++ b/garbage/garbage.go
@@ -11,6 +11,7 @@
 	"go/token"
 	"os"
 	"path"
+	"path/filepath"
 	"runtime"
 	"strings"
 	"sync"
@@ -105,7 +106,12 @@
 // parsePackage parses and returns net/http package.
 func parsePackage() ParsedPackage {
 	pkgname := "http"
-	dirpath := runtime.GOROOT() + "/src/pkg/net/http"
+	dirpath := filepath.Join(runtime.GOROOT(), "/src/pkg/net/", pkgname)
+	if !exists(dirpath) {
+		// As of 8th Sept 2014 the "pkg" prefix was removed from the std lib
+		// http://golang.org/s/go14nopkg
+		dirpath = filepath.Join(runtime.GOROOT(), "/src/net/", pkgname)
+	}
 	// filter function to select the desired .go files
 	filter := func(d os.FileInfo) bool {
 		if isPkgFile(d) {
@@ -148,3 +154,8 @@
 	}
 	return file.Name.Name
 }
+
+func exists(path string) bool {
+	_, err := os.Stat(path)
+	return !os.IsNotExist(err)
+}