mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
commands: Fix data race in test
Note that this is a test fix only.
This commit is contained in:
@@ -415,7 +415,7 @@ func Deprecated(item, alternative string, err bool) {
|
||||
DistinctErrorLog.Errorf("%s is deprecated and will be removed in Hugo %s. %s", item, hugo.CurrentVersion.Next().ReleaseVersion(), alternative)
|
||||
} else {
|
||||
var warnPanicMessage string
|
||||
if !loggers.PanicOnWarning {
|
||||
if !loggers.PanicOnWarning.Load() {
|
||||
warnPanicMessage = "\n\nRe-run Hugo with the flag --panicOnWarning to get a better error message."
|
||||
}
|
||||
DistinctWarnLog.Warnf("%s is deprecated and will be removed in a future release. %s%s", item, alternative, warnPanicMessage)
|
||||
|
@@ -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)
|
||||
}()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user