zip.Close() also clears the GOPATH of the underlying diskRef (#367)

* zip.Close() also clears underlying diskRef

* remove unnecessary constructor

* use GoBinPath() in example
This commit is contained in:
Rohan Chakravarthy
2018-07-31 09:38:45 -07:00
committed by Marwan Sulaiman
parent 6548509896
commit bbe1ce1873
7 changed files with 95 additions and 27 deletions
+3 -6
View File
@@ -38,22 +38,19 @@ func (g *goGetFetcher) Fetch(mod, ver string) (Ref, error) {
sourcePath := filepath.Join(goPathRoot, "src")
modPath := filepath.Join(sourcePath, getRepoDirName(mod, ver))
if err := g.fs.MkdirAll(modPath, os.ModeDir|os.ModePerm); err != nil {
diskRef := newDiskRef(g.fs, goPathRoot, "", "")
diskRef.Clear()
clearFiles(g.fs, goPathRoot)
return nil, err
}
// setup the module with barebones stuff
if err := Dummy(g.fs, modPath); err != nil {
diskRef := newDiskRef(g.fs, goPathRoot, "", "")
diskRef.Clear()
clearFiles(g.fs, goPathRoot)
return nil, err
}
err = getSources(g.goBinaryName, g.fs, goPathRoot, modPath, mod, ver)
if err != nil {
diskRef := newDiskRef(g.fs, goPathRoot, "", "")
diskRef.Clear()
clearFiles(g.fs, goPathRoot)
return nil, err
}