diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-06-16 18:58:40 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-06-16 18:58:40 +0200 |
commit | 31fb29fb3f306678f3697e05bbccefb2078d7f78 (patch) | |
tree | 716f2586c71abf1f49dc9e1fec450c4b7796ab6e /common | |
parent | d392893cd73dc00c927f342778f6dca9628d328e (diff) |
Do not read config from os.Environ when running tests
Fixes #8655
Diffstat (limited to 'common')
-rw-r--r-- | common/hugo/hugo.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/common/hugo/hugo.go b/common/hugo/hugo.go index 13ed47736..bf3dee26e 100644 --- a/common/hugo/hugo.go +++ b/common/hugo/hugo.go @@ -141,3 +141,13 @@ func GetDependencyList() []string { return deps } + +// IsRunningAsTest reports whether we are running as a test. +func IsRunningAsTest() bool { + for _, arg := range os.Args { + if strings.HasPrefix(arg, "-test") { + return true + } + } + return false +} |