main: replace manhole with gopreload

This commit is contained in:
Cadey Ratio 2017-03-27 10:26:34 -07:00
parent d52776a7fc
commit 99bc2a10b0
2 changed files with 9 additions and 22 deletions

9
gopreload.go Normal file
View File

@ -0,0 +1,9 @@
// gopreload.go
package main
/*
This file is separate to make it very easy to both add into an application, but
also very easy to remove.
*/
import _ "github.com/Xe/gopreload"

View File

@ -1,22 +0,0 @@
package main
import (
"log"
"net"
"net/http"
_ "net/http/pprof"
"net/rpc"
)
func init() {
l, err := net.Listen("tcp", "127.0.0.2:0")
if err != nil {
log.Printf("manhole: cannot bind to 127.0.0.2:0: %v", err)
return
}
log.Printf("manhole: Now listening on http://%s", l.Addr())
rpc.HandleHTTP()
go http.Serve(l, nil)
}