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.
9 _ "unsafe" // for go:linkname
12 // solarisExecutablePath is defined in the runtime package.
13 func solarisExecutablePath() string
15 var initCwd, initCwdErr = Getwd()
17 func executable() (string, error) {
18 path := solarisExecutablePath()
20 path, err := syscall.Getexecname()
25 if len(path) > 0 && path[0] != '/' {
26 if initCwdErr != nil {
27 return path, initCwdErr
29 if len(path) > 2 && path[0:2] == "./" {
33 return initCwd + "/" + path, nil