From ede9a5f2fab4b7f92f7b48045d521c6cb8fd38e3 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Thu, 5 Jan 2023 14:43:07 +0800 Subject: [PATCH] chore: add comments --- services/actions/notifier_helper.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/actions/notifier_helper.go b/services/actions/notifier_helper.go index 9caedbba33..0e91cb648d 100644 --- a/services/actions/notifier_helper.go +++ b/services/actions/notifier_helper.go @@ -30,6 +30,8 @@ import ( var methodCtxKey struct{} +// withMethod sets the notification method that this context currently executes. +// Used for debugging/ troubleshooting purposes. func withMethod(ctx context.Context, method string) context.Context { // don't overwrite if v := ctx.Value(methodCtxKey); v != nil { @@ -40,6 +42,9 @@ func withMethod(ctx context.Context, method string) context.Context { return context.WithValue(ctx, methodCtxKey, method) } +// getMethod gets the notification method that this context currently executes. +// Default: "notify" +// Used for debugging/ troubleshooting purposes. func getMethod(ctx context.Context) string { if v := ctx.Value(methodCtxKey); v != nil { if s, ok := v.(string); ok {