I am trying to write a go script to setup the user's name in the gitconfig file.
I tried the following arguments shown in the code below in the terminal and it works when I manually input the arguments sequentially, but it does not work from golang.
cl := exec.Command("git", "-C", "config", "--global", "user.name",
"myname")
stdout, err := cl.CombinedOutput()
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s", stdout)
From the code snippet I expect the code to generate a .gitconfig file and for the file to contain the name of the user. When I run the code I get exit status 128.