diff options
Diffstat (limited to 'swarm/sctx/sctx.go')
-rw-r--r-- | swarm/sctx/sctx.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/swarm/sctx/sctx.go b/swarm/sctx/sctx.go index bed2b1145..fb7d35b00 100644 --- a/swarm/sctx/sctx.go +++ b/swarm/sctx/sctx.go @@ -2,19 +2,17 @@ package sctx import "context" -type ContextKey int - -const ( - HTTPRequestIDKey ContextKey = iota - requestHostKey +type ( + HTTPRequestIDKey struct{} + requestHostKey struct{} ) func SetHost(ctx context.Context, domain string) context.Context { - return context.WithValue(ctx, requestHostKey, domain) + return context.WithValue(ctx, requestHostKey{}, domain) } func GetHost(ctx context.Context) string { - v, ok := ctx.Value(requestHostKey).(string) + v, ok := ctx.Value(requestHostKey{}).(string) if ok { return v } |