Original post

I’m trying to execute anytype of local script(sh/bash/python/ruby) or executable with arguments to a remote machine using .
ssh command: ssh user@10.10.10.10 "python3" - < ./test.py "arg1"

package main
import (
    "log"
    "os"

    ".org/x/crypto/ssh"
)

func main()  {
    user := "user"
    hostport := "10.10.10.10:22"
    script, _ := os.OpenFile("test.py", os.O_RDWR|os.O_CREATE, 0755)
    interpreter := "python3"
    client, session, err := connectToHost(user, hostport) 
    session.Stdin = script
    session.Stdout = os.Stdout
    err = session.Run(interpreter)
    if err != nil {
        log.Fatal(err)
    }
    client.Close()
    defer session.Close()
}

The example ssh command is working fine and I’m able to execute the local test.py in the remote server too, but I can’t think of any efficient way which will help me to pass arguments(ex. arg1) as well.
Thanks for the help.