github.com/wlattner/mlserver@v0.0.0-20141113171038-895f261d2bfd/Godeps/_workspace/src/bitbucket.org/kardianos/osext/osext_procfs.go (about) 1 // Copyright 2012 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 5 // +build linux netbsd openbsd solaris 6 7 package osext 8 9 import ( 10 "errors" 11 "fmt" 12 "os" 13 "runtime" 14 ) 15 16 func executable() (string, error) { 17 switch runtime.GOOS { 18 case "linux": 19 return os.Readlink("/proc/self/exe") 20 case "netbsd": 21 return os.Readlink("/proc/curproc/exe") 22 case "openbsd": 23 return os.Readlink("/proc/curproc/file") 24 case "solaris": 25 return os.Readlink(fmt.Sprintf("/proc/%d/path/a.out", os.Getpid())) 26 } 27 return "", errors.New("ExecPath not implemented for " + runtime.GOOS) 28 }