本文整理匯總了Golang中github.com/BurntSushi/xgb.Errorf函數的典型用法代碼示例。如果您正苦於以下問題:Golang Errorf函數的具體用法?Golang Errorf怎麽用?Golang Errorf使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Errorf函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Init
// Init must be called before using the BIG-REQUESTS extension.
func Init(c *xgb.Conn) error {
reply, err := xproto.QueryExtension(c, 12, "BIG-REQUESTS").Reply()
switch {
case err != nil:
return err
case !reply.Present:
return xgb.Errorf("No extension named BIG-REQUESTS could be found on on the server.")
}
c.ExtLock.Lock()
c.Extensions["BIG-REQUESTS"] = reply.MajorOpcode
c.ExtLock.Unlock()
for evNum, fun := range xgb.NewExtEventFuncs["BIG-REQUESTS"] {
xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
for errNum, fun := range xgb.NewExtErrorFuncs["BIG-REQUESTS"] {
xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun
}
return nil
}
示例2: Init
// Init must be called before using the XVideo-MotionCompensation extension.
func Init(c *xgb.Conn) error {
reply, err := xproto.QueryExtension(c, 25, "XVideo-MotionCompensation").Reply()
switch {
case err != nil:
return err
case !reply.Present:
return xgb.Errorf("No extension named XVideo-MotionCompensation could be found on on the server.")
}
xgb.ExtLock.Lock()
c.Extensions["XVideo-MotionCompensation"] = reply.MajorOpcode
for evNum, fun := range xgb.NewExtEventFuncs["XVideo-MotionCompensation"] {
xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
for errNum, fun := range xgb.NewExtErrorFuncs["XVideo-MotionCompensation"] {
xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun
}
xgb.ExtLock.Unlock()
return nil
}