Browse Source

Litter fix

pull/103/head
Unknown 12 years ago
parent
commit
1177eadf8b
  1. 4
      cmd/serve.go
  2. 6
      doc/google.go

4
cmd/serve.go

@ -149,7 +149,7 @@ func saveNode(nod *doc.Node) error {
url := fmt.Sprintf("http://%v:%v/add?%v", "localhost", "8991", nod.ImportPath)
resp, err := http.Get(url)
if err != nil {
com.ColorLog("%v\n", err.Error())
com.ColorLog("[ERRO] Fail to save node[ %s ]\n", err)
return err
}
defer resp.Body.Close()
@ -430,7 +430,7 @@ func addHandler(w http.ResponseWriter, r *http.Request) {
if nod != nil {
err := addNode(nod)
if err != nil {
fmt.Println(err)
com.ColorLog("[ERRO] SEVER: Cannot add node[ %s ]\n", err)
}
} else {
fmt.Println(key)

6
doc/google.go

@ -15,6 +15,7 @@
package doc
import (
"errors"
"net/http"
"os"
"path"
@ -56,6 +57,7 @@ func getGoogleDoc(client *http.Client, match map[string]string, installRepoPath
ext := ".zip"
if match["vcs"] == "svn" {
ext = ".tar.gz"
com.ColorLog("[WARN] SVN detected, may take very long time.\n")
}
err := packer.PackToFile(match["importPath"], installPath+ext, match)
@ -70,6 +72,10 @@ func getGoogleDoc(client *http.Client, match map[string]string, installRepoPath
dirs, err = com.UnTarGz(installPath+ext, path.Dir(installPath))
}
if len(dirs) == 0 {
return nil, errors.New("No file in repository")
}
if err != nil {
return nil, err
}

Loading…
Cancel
Save