If my go program can be executed in different ways (cron, monit, etc..), what's the most reliable way to get the directory that contains the executable, during runtime?
In python, this would be the variable:
os.path.realpath(__file__)
It's probably the same as in C, in other words, there isn't a portable fool-proof method. See How do I find the location of the executable in C?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With