Make myPrinter local to main

This commit is contained in:
Victor Timofei 2022-07-29 21:55:49 +03:00
parent 256f79a099
commit 70c944bc49
Signed by: vtimofei
GPG Key ID: B790DCEBE281403A
1 changed files with 6 additions and 6 deletions

View File

@ -36,12 +36,12 @@ func usePrinter(p Printer) {
printerCallbackLock.Unlock()
}
func main() {
var myPrinter Printer = Printer(func(n int) {
for i := 0; i < n; i++ {
fmt.Printf("%d\n", i)
}
})
func main() {
usePrinter(myPrinter)
}