summaryrefslogtreecommitdiff
path: root/funcs
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2022-05-29 11:49:57 -0400
committerDave Henderson <dhenderson@gmail.com>2022-05-29 11:52:46 -0400
commit82ded80fcef1965ab5357a89d201811436b5d8d7 (patch)
tree14914504ad80adb66cdd31c196db42c5a34b46b5 /funcs
parent170593638bb7cf10f5ec8309112d775059f40e02 (diff)
Stop passing the config in the context
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'funcs')
-rw-r--r--funcs/crypto_test.go9
-rw-r--r--funcs/funcs.go2
-rw-r--r--funcs/net_test.go9
3 files changed, 3 insertions, 17 deletions
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) {