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 var initCwd
, initCwdErr
= Getwd()
11 func executable() (string, error
) {
12 path
, err
:= syscall
.Getexecname()
16 if len(path
) > 0 && path
[0] != '/' {
17 if initCwdErr
!= nil {
18 return path
, initCwdErr
20 if len(path
) > 2 && path
[0:2] == "./" {
24 return initCwd
+ "/" + path
, nil