GPG命令在Shell中有效,但在Go exec.Command()中无效

I am using gnupg to encrypt files with the following command:

gpg --encrypt --sign --armor -r person@email.com name_of_file

This command works fine in shell. But it fails in go program with following error :

gpg: cannot open '/dev/tty': Device not configured

Here is the Code:

    func main() {
        var stdout, stderr bytes.Buffer

        cmd := exec.Command("/bin/sh", "-c", `gpg --encrypt --sign --armor -r person@email.com file_name.csv`)

        cmd.Stdout = &stdout
        cmd.Stderr = &stderr

        err := cmd.Run()
        if err != nil {
            log.Println(err)
        }

        out := stdout.String() + stderr.String()
        fmt.Println(out)
}

Why am I getting this error and how can I fix it?