Add support for building "release" builds that don't contain pprof which are substantially smaller. To build a "debug" build, use "-tags debug" with "go build"

This commit is contained in:
Neil Alexander 2018-05-27 23:22:50 +01:00
parent e9b1006dda
commit a9e61d0d37
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
3 changed files with 31 additions and 6 deletions

View file

@ -11,11 +11,7 @@ import "syscall"
import "time"
import "regexp"
import "math/rand"
import _ "net/http/pprof"
import "net/http"
import "log"
import "runtime"
import "yggdrasil"
import "yggdrasil/config"
@ -191,8 +187,9 @@ func main() {
logger := log.New(os.Stdout, "", log.Flags())
// If the -pprof flag was provided then start the pprof service on port 6060.
if *pprof {
runtime.SetBlockProfileRate(1)
go func() { log.Println(http.ListenAndServe("localhost:6060", nil)) }()
if err := yggdrasil.StartProfiler(logger); err != nil {
logger.Println(err)
}
}
// Setup the Yggdrasil node itself. The node{} type includes a Core, so we
// don't need to create this manually.