I can get your code to compile, but I cannot replicate your error.
(Instead I see what looks like an unrelated SIGABRT after the Go
callback returns.)
However, if I add -gcflags "-m -l -N" to your go install command, with
Go 1.4.2 I see:
./main.go:41: moved to heap: ccallbacks
./main.go:42: &ccallbacks escapes to heap
./main.go:29: main &repoPtr does not escape
./main.go:36: main &remotePtr does not escape
./main.go:43: main &ccallbacks does not escape
./main.go:44: main &ccallbacks does not escape
./main.go:45: main &ccallbacks does not escape
./main.go:55: main ... argument does not escape
./main.go:56: main &crefspecs does not escape
./main.go:57: main ... argument does not escape
That's a bug, the kind of bug that could cause the error you saw. In
fact, I believe it is
https://golang.org/issue/10303, which has been
fixed in Go 1.5. Running with tip I see:
./main.go:27: moved to heap: repoPtr
./main.go:29: &repoPtr escapes to heap
./main.go:33: moved to heap: remotePtr
./main.go:36: &remotePtr escapes to heap
./main.go:41: moved to heap: ccallbacks
./main.go:42: &ccallbacks escapes to heap
./main.go:43: &ccallbacks escapes to heap
./main.go:44: &ccallbacks escapes to heap
./main.go:45: &ccallbacks escapes to heap
./main.go:50: moved to heap: crefspecs
./main.go:56: &crefspecs escapes to heap
...which looks promising. Could you try out the Go 1.5 beta and see if
that resolves your issue?
d.