From 1177eadf8bcbe40d2eb0fa997ccdbf0b45b0cdcc Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 28 Aug 2013 09:02:03 +0800 Subject: [PATCH] Litter fix --- cmd/serve.go | 4 ++-- doc/google.go | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/serve.go b/cmd/serve.go index 0b2a38555..5afe15565 100644 --- a/cmd/serve.go +++ b/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) diff --git a/doc/google.go b/doc/google.go index 849abbe9d..aafe8a452 100644 --- a/doc/google.go +++ b/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 }