Go Standard Library Cookbook
上QQ阅读APP看书,第一时间看更新

Retrieving the current working directory

Another useful source of information for the application is the directory, where the program binary is located. With this information, the program can access the assets and files collocated with the binary file.

This recipe is using the solution for Go since version 1.8. This one is the preferred one.