this : 
http://craigwickesser.com/2015/02/golang-cmd-with-custom-environment/ ?


On Thursday, February 2, 2017 at 5:23:49 PM UTC+1, Rich wrote:
>
> Hi All,
>
> My dev team did a very bad thing and issued lots of scripts that they 
> wrote source a file that is in clear text which contains usernames / 
> passwords etc.  Without having to re-write a ton of existing bash scripts, 
> I wanted to use Go and have that set the usernames / passwords and 
> introduce some user validation etc. Is there a way for Go to set 
> environment variables that persist to the script that ran the go program? 
> For example:
>
> Go Program SetPass:
>
> package main
>
> import (
>     "fmt"
>     "os"
>
> )
>
> func main() {
>
>      os.Setenv("MyPass","Abc.1234")
>
> }
>
>
>
> Bash Script:
>
> #!/bin/bash
>
> /usr/local/bin/SetPass
>
> echo $MyPass
>
>
> This is a simplistic example, in the real script I'd do things like look 
> at the user / groups that are running the program to ensure that they've 
> got the rights to run.
>
> Thanks,
>
> Rich
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to