From a82027f3883353b8c0987bfa4175b9c7e80445b1 Mon Sep 17 00:00:00 2001 From: Josemar Luedke Date: Thu, 14 Nov 2024 08:56:44 -0800 Subject: [PATCH] bug: more reliably find out if running in tests --- config.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config.go b/config.go index d0fd843..c2a70b7 100644 --- a/config.go +++ b/config.go @@ -88,11 +88,12 @@ func unmarshalConfig(config interface{}) error { func isTesting() bool { for _, arg := range os.Args { - if strings.HasPrefix(arg, "-test.v=") { + if strings.Contains(arg, "-test") || strings.Contains(arg, ".test") { return true } } - return false || os.Getenv("ENV") == "test" + + return os.Getenv("ENV") == "test" } func getMetaConfig(config interface{}) *MetaConfig {