Browse Source

bug fixed

pull/103/head
Lunny Xiao 11 years ago
parent
commit
8ea0a011a8
  1. 6
      cmd/gopath.go

6
cmd/gopath.go

@ -37,9 +37,12 @@ func getGopmPkgs(dirPath string, isTest bool) (pkgs map[string]*doc.Pkg, err err
} }
pkg, err := build.ImportDir(dirPath, build.AllowBinary) pkg, err := build.ImportDir(dirPath, build.AllowBinary)
if err != nil {
pkg, err = build.ImportDir(newGoPath+dirPath[len(oldGoPath):], build.AllowBinary)
if err != nil { if err != nil {
return map[string]*doc.Pkg{}, errors.New("Fail to get imports: " + err.Error()) return map[string]*doc.Pkg{}, errors.New("Fail to get imports: " + err.Error())
} }
}
pkgs = make(map[string]*doc.Pkg) pkgs = make(map[string]*doc.Pkg)
var imports []string = pkg.Imports var imports []string = pkg.Imports
@ -135,6 +138,7 @@ var pkgName string
var curPath string var curPath string
var newCurPath string var newCurPath string
var newGoPath string var newGoPath string
var oldGoPath string
func execCmd(gopath, curPath string, args ...string) error { func execCmd(gopath, curPath string, args ...string) error {
cwd, err := os.Getwd() cwd, err := os.Getwd()
@ -160,7 +164,7 @@ func execCmd(gopath, curPath string, args ...string) error {
log.Fatal("", "\t"+err.Error()) log.Fatal("", "\t"+err.Error())
} }
oldGoPath := os.Getenv("GOPATH") oldGoPath = os.Getenv("GOPATH")
log.Log("Setting GOPATH to %s", gopath) log.Log("Setting GOPATH to %s", gopath)
sep := ":" sep := ":"

Loading…
Cancel
Save