aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/sctx
diff options
context:
space:
mode:
authorKimMachineGun <geon0250@gmail.com>2018-11-06 16:54:19 +0800
committerViktor TrĂ³n <viktor.tron@gmail.com>2018-11-06 16:54:19 +0800
commitbaee850471603d7fbf37eed0074c9de01df92ee7 (patch)
treecb53c5391d910589a80138c1757a2cc6d27feb04 /swarm/sctx
parent126dfde6c9de1f8122bb3991453d2429b47542f8 (diff)
downloadgo-tangerine-baee850471603d7fbf37eed0074c9de01df92ee7.tar
go-tangerine-baee850471603d7fbf37eed0074c9de01df92ee7.tar.gz
go-tangerine-baee850471603d7fbf37eed0074c9de01df92ee7.tar.bz2
go-tangerine-baee850471603d7fbf37eed0074c9de01df92ee7.tar.lz
go-tangerine-baee850471603d7fbf37eed0074c9de01df92ee7.tar.xz
go-tangerine-baee850471603d7fbf37eed0074c9de01df92ee7.tar.zst
go-tangerine-baee850471603d7fbf37eed0074c9de01df92ee7.zip
swarm: modify context key (#17925)
* swarm: modify context key * gofmt sctx.go
Diffstat (limited to 'swarm/sctx')
-rw-r--r--swarm/sctx/sctx.go12
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
}