title: Cache or Persist a value even if process ends
body: <p>Writing a CLI application in GoLang and want to use URL across different sessions/commands. Implementing CLI through Cobra where I want to configure URL at the beginning and then keep using it across other commands. </p>
  
  <p>Tried to use below approach -</p>
  
  <p><code>os.Setenv("URL", URL)
  os.Getenv("URL")
  </code></p>
  
  <p>Above approach works only inside the same process (doesn't work if set and get processes are different).</p>
  
  <p>Any idea how can we do it ?</p>
  
  <p><strong>Update</strong>:
  I wanted to know if it's possible to be done inside Go?
  I know it can be easily done by storing it in file/db or even setting up in environment variable but exploring ways to do it in Go.</p>