Skip to content

Commit

Permalink
Clean up unneeded variable. Use filepath.Join correctly.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dmitshur committed Feb 1, 2015
1 parent 8f6ee48 commit fb417b4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 5 additions & 2 deletions go13.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
7 changes: 5 additions & 2 deletions go14.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
3 changes: 0 additions & 3 deletions match.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fb417b4

Please sign in to comment.