diff --git a/daemon.go b/daemon.go index 6973991..b2c65a5 100644 --- a/daemon.go +++ b/daemon.go @@ -5,7 +5,6 @@ import ( "errors" "fmt" "io" - "net/url" "os" "os/exec" "runtime" @@ -419,8 +418,6 @@ func init() { as.RegisterType(cmdInfo{}) as.RegisterType(codeRepoAddr{}) as.RegisterType(getFileContent{}) - as.RegisterType((*url.Error)(nil)) - as.RegisterType((*exec.ExitError)(nil)) as.RegisterType(tryUpdate{}) as.RegisterType((*gshellBin)(nil)) } diff --git a/gshellos.go b/gshellos.go index cf256cf..ea4aa6f 100644 --- a/gshellos.go +++ b/gshellos.go @@ -5,10 +5,15 @@ import ( "encoding/hex" "errors" "io" + "net" + "net/url" "os" "os/exec" "strings" + "syscall" "time" + + as "github.com/godevsig/adaptiveservice" ) var ( @@ -106,3 +111,12 @@ func RunShCmd(cmd string) string { output, _ := exec.Command("sh", fields...).CombinedOutput() return string(output) } + +func init() { + as.RegisterType((*net.OpError)(nil)) + as.RegisterType((*net.TCPAddr)(nil)) + as.RegisterType((*os.SyscallError)(nil)) + as.RegisterType(syscall.Errno(0)) + as.RegisterType((*url.Error)(nil)) + as.RegisterType((*exec.ExitError)(nil)) +} diff --git a/http.go b/http.go index 344e65d..9d72561 100644 --- a/http.go +++ b/http.go @@ -5,12 +5,7 @@ package gshellos import ( "fmt" "io" - "net" "net/http" - "os" - "syscall" - - as "github.com/godevsig/adaptiveservice" ) func init() { @@ -34,10 +29,3 @@ func httpGetFunc(url string) ([]byte, error) { return body, nil } - -func init() { - as.RegisterType((*net.OpError)(nil)) - as.RegisterType((*net.TCPAddr)(nil)) - as.RegisterType((*os.SyscallError)(nil)) - as.RegisterType(syscall.Errno(0)) -}