New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
runtime: panic: runtime error: index out of range on all commands on Darwin #24394
Comments
For some reason, runtime/os_darwin.go:sysargs failed to set os.executablePath, or set it to the empty string. There's an obvious recovery fix we should add--sanity check that os.executablePath is non-empty at the beginning of os.executable--but it would be good to know why it is empty in the first place. Can you try modifying func sysargs(argc int32, argv **byte) {
println("argc", argc)
// skip over argv, envv and the first string will be the path
n := argc + 1
for argv_index(argv, n) != nil {
n++
}
println("n", n)
executablePath = gostringnocopy(argv_index(argv, n+1))
println("raw", executablePath)
// strip "executable_path=" prefix if available, it's added after OS X 10.11.
const prefix = "executable_path="
if len(executablePath) > len(prefix) && executablePath[:len(prefix)] == prefix {
executablePath = executablePath[len(prefix):]
}
println("final", executablePath)
} Then run |
Made the change and now I get this:
(tried as both sudo and not sudo) I don't have anything set to $GOROOT What should I set it as? |
@patricklunney You can try this.
|
Still didn't work:
|
Drat. Bootstrapping. Sadly, it's going to be a bit more complicated than I thought to get a local build going for you to investigate. Are you game for it? Happy to help you through through the process. |
Sure. What do I do? |
Step one is getting you a functioning Go installation. :) Maybe grab 1.9.4 from https://golang.org/dl/ and put it in some other (non-homebrew) location and see whether it works for you. If not 1.9.4, try 1.8.x. Once that is up and running, |
How's it going @patricklunney? Josh posted some tips in order to bootstrap your Go installation, please take a look. Thank you. |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
@gopherbot remove label WaitingForInfo |
You have to remove the |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?$ go version
panic: runtime error: index out of range
goroutine 1 [running]:
os.executable(...)
/usr/local/Cellar/go/1.10/libexec/src/os/executable_darwin.go:13
os.Executable(...)
/usr/local/Cellar/go/1.10/libexec/src/os/executable.go:21
cmd/go/internal/cfg.findGOROOT(0xc42001e2c0, 0x17)
/usr/local/Cellar/go/1.10/libexec/src/cmd/go/internal/cfg/cfg.go:107 +0x441
Does this issue reproduce with the latest release?
I don't know what version, I think 1.10 based on the .pkg download
What operating system and processor architecture are you using (
go env
)?OSX 10.12
$ go env
panic: runtime error: index out of range
goroutine 1 [running]:
os.executable(...)
/usr/local/Cellar/go/1.10/libexec/src/os/executable_darwin.go:13
os.Executable(...)
/usr/local/Cellar/go/1.10/libexec/src/os/executable.go:21
cmd/go/internal/cfg.findGOROOT(0xc42001e2c0, 0x17)
/usr/local/Cellar/go/1.10/libexec/src/cmd/go/internal/cfg/cfg.go:107 +0x441
What did you do?
Installed go.
Let me know if you need any other docs.
Any idea why it isn't working?
The text was updated successfully, but these errors were encountered: