Browse Source

Code fix

pull/103/head
Unknown 12 years ago
parent
commit
393d351826
  1. 2
      cmd/get.go
  2. 2
      cmd/serve.go
  3. 18
      doc/utils.go

2
cmd/get.go

@ -120,7 +120,7 @@ func runGet(cmd *Command, args []string) {
return return
} }
hd, err := doc.GetHomeDir() hd, err := com.HomeDir()
if err != nil { if err != nil {
com.ColorLog("[ERRO] Fail to get current user[ %s ]\n", err) com.ColorLog("[ERRO] Fail to get current user[ %s ]\n", err)
return return

2
cmd/serve.go

@ -332,7 +332,7 @@ func runningStatus() (int, int, int) {
} }
func startService(listen string) { func startService(listen string) {
homeDir, err := doc.GetHomeDir() homeDir, err := com.HomeDir()
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
return return

18
doc/utils.go

@ -16,10 +16,8 @@ package doc
import ( import (
"os" "os"
"os/user"
"path" "path"
"regexp" "regexp"
"runtime"
"strings" "strings"
"github.com/Unknwon/com" "github.com/Unknwon/com"
@ -620,22 +618,6 @@ func IsGoRepoPath(importPath string) bool {
return standardPath[importPath] return standardPath[importPath]
} }
func GetHomeDir() (string, error) {
if runtime.GOOS != "windows" {
curUser, err := user.Current()
if err != nil {
return "", err
}
return curUser.HomeDir, nil
} else {
hd, err := com.HomeDir()
if err != nil {
return "", err
}
return hd, nil
}
}
func CheckNodeValue(v string) string { func CheckNodeValue(v string) string {
if len(v) == 0 { if len(v) == 0 {
return "<UTD>" return "<UTD>"

Loading…
Cancel
Save