Open patricklunney opened 6 years ago
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 /usr/local/Cellar/go/1.10/libexec/src/runtime/os_darwin.go
, func sysargs
(at the bottom), to look like this:
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 /usr/local/Cellar/go/1.10/libexec/src/make.bash
, and then try go env
again and let us know what it says. Thanks.
Made the change and now I get this:
$ sudo /usr/local/Cellar/go/1.10/libexec/src/make.bash
Password:
make.bash must be run from $GOROOT/src
(tried as both sudo and not sudo)
I don't have anything set to $GOROOT $ echo $GOROOT
What should I set it as?
@patricklunney You can try this.
cd /usr/local/Cellar/go/1.10/libexec/src && ./make.bash
Still didn't work:
$ cd /usr/local/Cellar/go/1.10/libexec/src && ./make.bash
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(0xc420024280, 0x17)
/usr/local/Cellar/go/1.10/libexec/src/cmd/go/internal/cfg/cfg.go:107 +0x441
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, export GOROOT_BOOTSTRAP=path/to/working/go
. Try executing $GOROOT_BOOTSTRAP/bin/go version
to make the envvar is set up correctly. (See https://golang.org/doc/install/source#go14 for lots more detail here.) Then try make.bash
again, with that envvar.
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.)
@andybons @bradfitz could you please help me tame the machine? It just re-closed an issue that I just re-opened
@gopherbot remove label WaitingForInfo
You have to remove the WaitingForInfo
label if you re-open a change that is closed do to it being too long since someone responded.
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?