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

6
doc/google.go

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

Loading…
Cancel
Save