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.
5 // +build hurd linux netbsd dragonfly nacl js,wasm
14 // We query the executable path at init time to avoid the problem of
15 // readlink returns a path appended with " (deleted)" when the original
16 // binary gets deleted.
17 var executablePath, executablePathErr = func() (string, error) {
21 return "", errors.New("Executable not implemented for " + runtime.GOOS)
22 case "hurd", "linux", "android":
23 procfn = "/proc/self/exe"
25 procfn = "/proc/curproc/exe"
27 procfn = "/proc/curproc/file"
29 return Readlink(procfn)
32 func executable() (string, error) {
33 return executablePath, executablePathErr