From 82ded80fcef1965ab5357a89d201811436b5d8d7 Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Sun, 29 May 2022 11:49:57 -0400 Subject: Stop passing the config in the context Signed-off-by: Dave Henderson --- funcs/crypto_test.go | 9 +-------- funcs/funcs.go | 2 +- funcs/net_test.go | 9 +-------- 3 files changed, 3 insertions(+), 17 deletions(-) (limited to 'funcs') diff --git a/funcs/crypto_test.go b/funcs/crypto_test.go index d14b37e6..9d6f8975 100644 --- a/funcs/crypto_test.go +++ b/funcs/crypto_test.go @@ -26,14 +26,7 @@ func TestCreateCryptoFuncs(t *testing.T) { } func testCryptoNS() *CryptoFuncs { - ctx := context.Background() - cfg := config.FromContext(ctx) - cfg.Experimental = true - ctx = config.ContextWithConfig(ctx, cfg) - - return &CryptoFuncs{ - ctx: ctx, - } + return &CryptoFuncs{ctx: config.SetExperimental(context.Background())} } func TestPBKDF2(t *testing.T) { diff --git a/funcs/funcs.go b/funcs/funcs.go index 6b5da5cb..41687a19 100644 --- a/funcs/funcs.go +++ b/funcs/funcs.go @@ -8,7 +8,7 @@ import ( ) func checkExperimental(ctx context.Context) error { - if !config.FromContext(ctx).Experimental { + if !config.ExperimentalEnabled(ctx) { return fmt.Errorf("experimental function, but experimental mode not enabled") } return nil diff --git a/funcs/net_test.go b/funcs/net_test.go index 0b20ade9..fcf03770 100644 --- a/funcs/net_test.go +++ b/funcs/net_test.go @@ -74,14 +74,7 @@ func TestParseIPRange(t *testing.T) { } func testNetNS() *NetFuncs { - ctx := context.Background() - cfg := config.FromContext(ctx) - cfg.Experimental = true - ctx = config.ContextWithConfig(ctx, cfg) - - return &NetFuncs{ - ctx: ctx, - } + return &NetFuncs{ctx: config.SetExperimental(context.Background())} } func TestCIDRHost(t *testing.T) { -- cgit v1.2.3