mirror of
https://github.com/restic/restic.git
synced 2024-12-23 08:16:36 +00:00
DebugIf: only test function when tag is enabled
This commit is contained in:
parent
6aed4035f5
commit
c9ee79fc54
1 changed files with 5 additions and 0 deletions
|
@ -173,6 +173,11 @@ func Break(tag string) {
|
|||
// is contained in the DEBUG_BREAK environment variable and the return value of
|
||||
// fn is true.
|
||||
func BreakIf(tag string, fn func() bool) {
|
||||
// check if breaking is enabled
|
||||
if v, ok := opts.breaks[tag]; !ok || !v {
|
||||
return
|
||||
}
|
||||
|
||||
if fn() {
|
||||
Break(tag)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue