如何为通过go脚本运行的终端命令提供选项?

Lets suppose I have a go script which invokes the command

yum install packagename.

It comes to a point where it asks y/n to install the package, there is --assumeyes option in yum (in this case) which i dont want to use.

Is there any other way in go to send y to the command as i dont want to give the y manually when running the script

The y is inputted via stdin. When you launch a subprocess, you give it a writer where you can write to its stdin.

The os/exec docs have an example.