github.com/jtzjtz/kit@v1.0.2/ctx/ctx.go (about) 1 package ctx 2 3 import ( 4 "context" 5 "time" 6 ) 7 8 func CreateContext() (context.Context, context.CancelFunc) { 9 return CreateContextWithTime(time.Second * 30) 10 } 11 12 func CreateContextWithTime(timeOut time.Duration) (context.Context, context.CancelFunc) { 13 return context.WithTimeout(context.Background(), timeOut) 14 }