Commit d74c9d41 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 95d0183c
......@@ -28,7 +28,7 @@ import (
"lab.nexedi.com/kirr/neo/go/xcommon/log"
)
// running is syntatic sugar to push new task to operational stack, log it and
// running is syntactic sugar to push new task to operational stack, log it and
// adjust error return with task prefix.
//
// use like this:
......@@ -38,7 +38,7 @@ func running(ctxp *context.Context, name string) func(*error) {
return _running(ctxp, name)
}
// runningf is running cousing with formatting support
// runningf is running cousin with formatting support
func runningf(ctxp *context.Context, format string, argv ...interface{}) func(*error) {
return _running(ctxp, fmt.Sprintf(format, argv...))
}
......
......@@ -40,7 +40,7 @@ func Running(ctx context.Context, name string) context.Context {
return context.WithValue(ctx, taskKey{}, &Task{Parent: Current(ctx), Name: name})
}
// Runningf is Running cousing with formatting support
// Runningf is Running cousin with formatting support
func Runningf(ctx context.Context, format string, argv ...interface{}) context.Context {
return Running(ctx, fmt.Sprintf(format, argv...))
}
......@@ -53,14 +53,14 @@ func Current(ctx context.Context) *Task {
}
// ErrContext adds current task name to error on error return.
// to work as intended it should be called under defer like this:
// To work as intended it should be called under defer like this:
//
// func myfunc(ctx, ...) (..., err error) {
// ctx = task.Running("doing something")
// defer task.ErrContext(&err, ctx)
// ...
//
// Please see lab.nexedi.com/kirr/go123/xerr.Context for semantic details
// Please see lab.nexedi.com/kirr/go123/xerr.Context for semantic details.
func ErrContext(errp *error, ctx context.Context) {
task := Current(ctx)
if task == nil {
......@@ -72,9 +72,9 @@ func ErrContext(errp *error, ctx context.Context) {
// String returns string representing whole operational stack.
//
// For example if task "c" is running under task "b" which in turn is running
// under task "a" - the operational stack will be "a: b: c"
// under task "a" - the operational stack will be "a: b: c".
//
// nil Task is represented as ""
// nil Task is represented as "".
func (t *Task) String() string {
if t == nil {
return ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment