Exercise in determining from whence we came.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
623 B

9 years ago
9 years ago
  1. ## exedir
  2. Examples of methods for determining the directory path where our executable resides.
  3. - The `github.com/kardianos/osext` package is used for reference. The other methods
  4. will require that the executable is located within the OS search path.
  5. - The first alternative utilizes `exec.LookPath` to find the executable within the
  6. OS search path. This method depends on the `os`, `os/exec`, and `path` packages.
  7. - The next method defines a local function to look for the file named in `args[0]`
  8. in the directories listed in the `PATH` environment variable. This method depends
  9. on the `os` and `strings` packages.