This repository has been archived on 2022-01-04. You can view files and clone it, but cannot push or open issues/pull-requests.
syg_go/debug.go

23 lines
381 B
Go

// +build debug
package main
import (
"net/http"
_ "net/http/pprof"
"os"
)
func init() {
listen := os.Getenv("SYGGO_HTTP")
if listen == "" {
listen = "[::]:8082"
}
stdout.Printf("profiling is enabled, HTTP server is attached to %s\n", listen)
go func() {
if err := http.ListenAndServe(listen, nil); err != nil {
stderr.Fatalf("http failed: %v\n", err)
}
}()
}