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