Documentation ¶
Overview ¶
Package lookpath implements utilities to find executables.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Look ¶
Look returns the absolute path of the executable with the given name. If name only contains a single path component, the dirs in env["PATH"] are consulted, and the first match is returned. Otherwise, for multi-component paths, the absolute path of the name is looked up directly.
The behavior is the same as LookPath in the os/exec package, but allows the env to be passed in explicitly.
func LookPrefix ¶
LookPrefix returns the absolute paths of all executables with the given name prefix. If prefix only contains a single path component, the directories in env["PATH"] are consulted. Otherwise, for multi-component prefixes, only the directory containing the prefix is consulted. If multiple executables with the same base name match the prefix in different directories, the first match is returned. Returns a list of paths sorted by base name.
The names are filled in as the method runs, to ensure the first matching property. As a consequence, you may pass in a pre-populated names map to prevent matching those names. It is fine to pass in a nil names map.
Types ¶
This section is empty.