slackcontext

package
v0.0.0-...-d54492c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package slackcontext defines getters and setters for execution-scoped values that are propagated through context.Context during the execution of a Slack command. These values may include unique identifiers, session metadata, host information, version details, and other execution data.

All values should be set in the context before a Slack command begins execution. The values can then be accessed throughout the command's execution lifecycle using the provided getter methods.

Each value is stored with an unexported key type to prevent collisions with other packages using context values. The package provides type-safe accessors for retrieving these values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MockContext

func MockContext(ctx context.Context) context.Context

MockContext sets values in the context that are guaranteed to exist before the Cobra root command is executed.

func OpenTracingSpan

func OpenTracingSpan(ctx context.Context) (opentracing.Span, error)

OpenTracingSpan returns the `opentracing.Span“ associated with `ctx`, or `nil` and `slackerror.ErrContextValueNotFound` if no `Span` could be found.

func OpenTracingTraceID

func OpenTracingTraceID(ctx context.Context) (string, error)

OpenTracingTraceID returns the trace ID associated with `ctx`, or `""` and `slackerror.ErrContextValueNotFound` if no trace ID could be found.

func OpenTracingTracer

func OpenTracingTracer(ctx context.Context) (opentracing.Tracer, error)

OpenTracingTracer returns the `opentracing.Tracer` associated with `ctx`, or `nil` and `slackerror.ErrContextValueNotFound` if no `Tracer` could be found.

func ProjectID

func ProjectID(ctx context.Context) (string, error)

ProjectID returns the project ID associated with `ctx`, or `""` and `slackerror.ErrContextValueNotFound` if no project ID could be found.

func SessionID

func SessionID(ctx context.Context) (string, error)

SessionID returns the session ID associated with `ctx`, or `""` and `slackerror.ErrContextValueNotFound` if no session ID could be found.

func SetOpenTracingSpan

func SetOpenTracingSpan(ctx context.Context, span opentracing.Span) context.Context

SetOpenTracingSpan returns a new `context.Context` that holds a reference to the span. If span is nil, a new context without an active span is returned.

func SetOpenTracingTraceID

func SetOpenTracingTraceID(ctx context.Context, traceID string) context.Context

SetOpenTracingTraceID returns a new `context.Context` that holds a reference to the `traceID`.

func SetOpenTracingTracer

func SetOpenTracingTracer(ctx context.Context, tracer opentracing.Tracer) context.Context

SetOpenTracingSpan returns a new `context.Context` that holds a reference to the `opentracing.Tracer`. If tracer is nil, a new context without a tracer returned.

func SetProjectID

func SetProjectID(ctx context.Context, projectID string) context.Context

SetProjectID returns a new `context.Context` that holds a reference to the `projectID` and updates the `opentracing.Span` tag with the `projectID`.

func SetSessionID

func SetSessionID(ctx context.Context, sessionID string) context.Context

SetSessionID returns a new `context.Context` that holds a reference to the `sessionID`.

func SetSystemID

func SetSystemID(ctx context.Context, systemID string) context.Context

SetSystemID returns a new `context.Context` that holds a reference to the `systemID` and updates the `opentracing.Span` tag with the `systemID`.

func SetVersion

func SetVersion(ctx context.Context, version string) context.Context

SetVersion adds the slack-cli version to Golang context for trace logging

func SystemID

func SystemID(ctx context.Context) (string, error)

SystemID returns the session ID associated with `ctx`, or `""` and `slackerror.ErrContextValueNotFound` if no system ID could be found.

func Version

func Version(ctx context.Context) (string, error)

Version returns the CLI version associated with `ctx`, or `""` and `slackerror.ErrContextValueNotFound` if no version could be found.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL