title: Find the path to the executable
body: <p>I compile a program with Go for various platforms and run it by calling a relative path or just by its name (if it is in the PATH variable).</p>
  
  <p>Is it possible to find out where the executable is?</p>
  
  <p>Say, my program is called "<code>foo</code>(<code>.exe</code>)". I can run <code>./foo</code>, <code>foo</code> (if it's in the PATH), <code>../../subdir/subdir/foo</code>.</p>
  
  <p>I have tried to use <code>os.Args[0]</code> and I guess I should check if the program name contains something different besides "foo". If yes, use <code>filepath.Abs</code>, if no, use (I can't find the function name, there is a function that looks through the PATH to check where the program is).</p>