Skip to content

Commit

Permalink
Add type to use as keys for values attached to the BackgroundActivity…
Browse files Browse the repository at this point in the history
…Context

go lint rules error out if the type of the key passed to context.WithValue
is a basic type. The official golang documentation for context also provides
an example of using strongly typed keys: https://blog.golang.org/context#TOC_3.2.

This change provides a type in the Cadence client library that can be used to
attach data to the BackgroundActivityContext.
  • Loading branch information
molteanu committed Oct 4, 2017
1 parent b13ab9c commit 8b5ece3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions worker.go
Expand Up @@ -97,6 +97,10 @@ type (
// like common logger for all activities.
BackgroundActivityContext context.Context
}

// ActivityContextValueKey is a type to be used as the key for data attached
// as values to the BackgroundActivityContext.
ActivityContextValueKey int
)

// NewWorker creates an instance of worker for managing workflow and activity executions.
Expand Down

0 comments on commit 8b5ece3

Please sign in to comment.