多谢huan du 和felix ,使用os/exec就可以处理所有的内容了.

Package exec runs external commands. It wraps os.StartProcess to make it easier to remap stdin and stdout, connect I/O with pipes, and do other adjustments.

package main

import (
        "fmt"
        "io"
        "log"
        "os"
        "os/exec"
       )

func checkError(err error) {
    if err != nil {
        log.Fatalf("Error: %s", err)
    }
}

func main() {
    // Replace `ls` (and its arguments) with something more interesting
cmd := exec.Command("ssh", "1.1.1.1","find /")

         // Create stdout, stderr streams of type io.Reader
         stdout, err := cmd.StdoutPipe()
         checkError(err)
         stderr, err := cmd.StderrPipe()
         checkError(err)

         // Start command
         err = cmd.Start()
         checkError(err)

         // Don't let main() exit before our command has finished running
         defer cmd.Wait()  // Doesn't block

         // Non-blockingly echo command output to terminal
         go io.Copy(os.Stdout, stdout)
         go io.Copy(os.Stderr, stderr)

         // I love Go's trivial concurrency :-D
         fmt.Printf("Do other stuff here! No need to wait.\n\n")
}