Make myPrinter local to main
This commit is contained in:
parent
256f79a099
commit
70c944bc49
12
main.go
12
main.go
|
@ -36,12 +36,12 @@ func usePrinter(p Printer) {
|
|||
printerCallbackLock.Unlock()
|
||||
}
|
||||
|
||||
var myPrinter Printer = Printer(func(n int) {
|
||||
for i := 0; i < n; i++ {
|
||||
fmt.Printf("%d\n", i)
|
||||
}
|
||||
})
|
||||
|
||||
func main() {
|
||||
var myPrinter Printer = Printer(func(n int) {
|
||||
for i := 0; i < n; i++ {
|
||||
fmt.Printf("%d\n", i)
|
||||
}
|
||||
})
|
||||
|
||||
usePrinter(myPrinter)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue