I don't know if this is the best way to solve this but this is the way I did it:
- I decided to place this script executable into /opt/< dir-name >/bin
- I wrote an extra function which creates the auth .json /opt/< dir-name >/auth.json
- All the script executes using this /opt/< dir-name >/auth.json file
- I write another func which deletes the auth.json when the execution ends
So, now I can do this:
var file string = "/opt/< dir-name >/auth.json" sa := option.WithCredentialsFile(file)
Now I can share this script with the directive "Install into /opt/< dir-name>/bin and add this to your $PATH"