From e27c1d68068b6b22e31cfc0338b316b4c6735f8d Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 19 May 2021 12:02:20 -0700 Subject: [PATCH] use a struct as a key for the context --- .travis.yml | 3 +-- context.go | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4cfe98c..d021e01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,13 +4,12 @@ os: language: go go: - - 1.11.x + - 1.15.x env: global: - GOTFLAGS="-race" matrix: - - BUILD_DEPTYPE=gx - BUILD_DEPTYPE=gomod diff --git a/context.go b/context.go index 8796b8b..eaed01d 100644 --- a/context.go +++ b/context.go @@ -2,7 +2,9 @@ package metrics import "context" -const CtxScopeKey = "ipfs.metrics.scope" +type ctxScopeKey struct{} + +var CtxScopeKey = ctxScopeKey{} func CtxGetScope(ctx context.Context) string { s := ctx.Value(CtxScopeKey)