Description
What version of Go are you using (go version
)?
go version go1.9.2 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/adamb/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9.2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/g2/km2y9qqj4bbf329f2bt1xqc80000gn/T/go-build521592560=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
What did you do?
I have a function which calls os.Executable
in my Go source file. I bind it with gomobile like this:
gomobile bind --target ios --tags ios -v
and use the output framework in my iOS project in Xcode 9. Finally, I just call my Go function from ObjC.
What did you expect to see?
An executable path or error.
What did you see instead?
A panic:
panic: runtime error: index out of range
goroutine 17 [running, locked to thread]:
os.executable(...)
/usr/local/Cellar/go/1.9.2/libexec/src/os/executable_darwin.go:13
os.Executable(...)
/usr/local/Cellar/go/1.9.2/libexec/src/os/executable.go:21