From fb417b44ad915a5391a308f01e6a41117acced3d Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Sat, 31 Jan 2015 23:02:30 -0800 Subject: [PATCH] Clean up unneeded variable. Use filepath.Join correctly. The variable goroot was not being used anywhere else, except as part of gorootSrcPkg. It can be removed. Also, filepath.Join accepts individual path elements and cleans the result, so I've split "src/pkg" into two path elements. --- go13.go | 7 +++++-- go14.go | 7 +++++-- match.go | 3 --- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/go13.go b/go13.go index ba286d0..437f6d2 100644 --- a/go13.go +++ b/go13.go @@ -2,6 +2,9 @@ package gotool -import "path/filepath" +import ( + "path/filepath" + "runtime" +) -var gorootSrcPkg = filepath.Join(goroot, "src/pkg") +var gorootSrcPkg = filepath.Join(runtime.GOROOT(), "src", "pkg") diff --git a/go14.go b/go14.go index 05faf25..80a383f 100644 --- a/go14.go +++ b/go14.go @@ -2,6 +2,9 @@ package gotool -import "path/filepath" +import ( + "path/filepath" + "runtime" +) -var gorootSrcPkg = filepath.Join(goroot, "src") +var gorootSrcPkg = filepath.Join(runtime.GOROOT(), "src") diff --git a/match.go b/match.go index b33bedf..ee821bb 100644 --- a/match.go +++ b/match.go @@ -37,12 +37,9 @@ import ( "path" "path/filepath" "regexp" - "runtime" "strings" ) -var goroot = filepath.Clean(runtime.GOROOT()) - var buildContext = build.Default // matchPattern(pattern)(name) reports whether