我运行了scp -i ssh“ <远程linux计算机的文件路径>”。 ”从我的客户端计算机上使用“ Go”,但返回“没有这样的文件或目录” [重复]

How to execute the scp -i ssh " . " using Go?

I have used the following code snippet.

cmd := exec.Command("scp -i dragonstone.pem <user>@ubuntu:<file location> .")
err = cmd.Run()
</div>

I will do this.

package main

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

func main() {
    cmd := "scp"
    args := []string{"-i", "dragonstone.pem", "<user>@ubuntu:<file location>", "."}
    if err := exec.Command(cmd, args...).Run(); err != nil {
        fmt.Fprintln(os.Stderr, err)
        os.Exit(1)
    }
    fmt.Println("Successfully.")
}