if/else to switch

This commit is contained in:
Antoni Sawicki 2022-11-06 01:20:18 -08:00
parent fdfbe80024
commit 9cd286add8
1 changed files with 3 additions and 2 deletions

5
wrp.go
View File

@ -475,9 +475,10 @@ func main() {
) )
actx, acancel := chromedp.NewExecAllocator(context.Background(), opts...) actx, acancel := chromedp.NewExecAllocator(context.Background(), opts...)
defer acancel() defer acancel()
if debug { switch debug {
case true:
ctx, cancel = chromedp.NewContext(actx, chromedp.WithDebugf(log.Printf)) ctx, cancel = chromedp.NewContext(actx, chromedp.WithDebugf(log.Printf))
} else { default:
ctx, cancel = chromedp.NewContext(actx) ctx, cancel = chromedp.NewContext(actx)
} }
defer cancel() defer cancel()