executable.go 774 B

1234567891011121314151617181920
  1. // Copyright 2016 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package os
  5. // Executable returns the path name for the executable that started
  6. // the current process. There is no guarantee that the path is still
  7. // pointing to the correct executable. If a symlink was used to start
  8. // the process, depending on the operating system, the result might
  9. // be the symlink or the path it pointed to. If a stable result is
  10. // needed, path/filepath.EvalSymlinks might help.
  11. //
  12. // Executable returns an absolute path unless an error occurred.
  13. //
  14. // The main use case is finding resources located relative to an
  15. // executable.
  16. func Executable() (string, error) {
  17. return executable()
  18. }