What I want to do is exporting a file from my server via SFTP, in golang.
Here is the troubling code
cmd = exec.Command("sftp", "login@sftp.com", `INPUT
cd /some/path
put file.gz
quit
INPUT`)
cmd.Stderr = &stderr
err = cmd.Run()
if err != nil {
fmt.Println(stderr.String())
os.Exit(1)
}
fmt.Println("done")
It gets to done
but doesn't import file.gz
.