Make myPrinter local to main
This commit is contained in:
parent
256f79a099
commit
70c944bc49
2
main.go
2
main.go
|
@ -36,12 +36,12 @@ func usePrinter(p Printer) {
|
||||||
printerCallbackLock.Unlock()
|
printerCallbackLock.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
var myPrinter Printer = Printer(func(n int) {
|
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