diff options
author | Bjørn Erik Pedersen <[email protected]> | 2023-03-14 12:18:42 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2023-03-14 12:18:42 +0100 |
commit | 0fbab7cbc5a0b57ec875858111b178160d18acb5 (patch) | |
tree | ac718d00f98bf7df0cef4d82d3e8db527f85560d /helpers/general_test.go | |
parent | f5eddf89bf6c8ea9571c16f301f6b449259e6187 (diff) | |
download | hugo-0fbab7cbc5a0b57ec875858111b178160d18acb5.tar.gz hugo-0fbab7cbc5a0b57ec875858111b178160d18acb5.zip |
commands: Fix data race in test
Note that this is a test fix only.
Diffstat (limited to 'helpers/general_test.go')
-rw-r--r-- | helpers/general_test.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/helpers/general_test.go b/helpers/general_test.go index 95d9c5461..b2ee03f15 100644 --- a/helpers/general_test.go +++ b/helpers/general_test.go @@ -65,10 +65,10 @@ func TestDistinctLoggerDoesNotLockOnWarningPanic(t *testing.T) { // Set PanicOnWarning to true to reproduce issue 9380 // Ensure global variable loggers.PanicOnWarning is reset to old value after test - if loggers.PanicOnWarning == false { - loggers.PanicOnWarning = true + if !loggers.PanicOnWarning.Load() { + loggers.PanicOnWarning.Store(true) defer func() { - loggers.PanicOnWarning = false + loggers.PanicOnWarning.Store(false) }() } |