Richard Bucker

Stick with the Golang Stdlib

Posted at — Apr 11, 2015

So many people get all wrapped up up using 3rd party packages for everything from processing command line flags to Fourier transforms. While I know absolutely nothing about Fourier transforms and quite a lot about processing the CLI I’m not about to import packages that I do not trust and understand.For example:I read this article on working directories. At first I thought it was a reasonable idea. Then the author linked to a package osext. And I about fell out of my chair. I posted a response to the article which has not been moderated yet but it went something like:os.Args[0] already provides the fullpath of the executable. It even works with go run. However, locating artifacts and config files it idoimatic beyond golang. ¬†look in /etc, $HOME, cwd, exec and CLI. Using the path to the executable is not idiomatic especially for webservers as in the given example.