本文整理匯總了Golang中github.com/pipeviz/pipeviz/types/system.CoreGraph.MsgId方法的典型用法代碼示例。如果您正苦於以下問題:Golang CoreGraph.MsgId方法的具體用法?Golang CoreGraph.MsgId怎麽用?Golang CoreGraph.MsgId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/pipeviz/pipeviz/types/system.CoreGraph
的用法示例。
在下文中一共展示了CoreGraph.MsgId方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: init
func init() {
startTime := time.Now().UTC()
expvar.Publish("Uptime", expvar.Func(func() interface{} { return int64(time.Since(startTime)) }))
expvar.Publish("Goroutines", expvar.Func(func() interface{} { return runtime.NumGoroutine() }))
// subscribe to the broker in order to report data about current graph
c := broker.Get().Subscribe()
// Instantiate a real, empty graph to ensure the interface type is never nil when it might be called
var g system.CoreGraph = represent.NewGraph()
go func() {
for latest := range c {
g = latest
}
}()
expvar.Publish("MsgId", expvar.Func(func() interface{} { return g.MsgId() }))
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
}