100-go-mistakes/09-concurrency-practice/62-starting-goroutine/listing3/main.go
2021-12-27 15:57:20 +01:00

23 lines
291 B
Go

package main
func main() {
w := newWatcher()
defer w.close()
// Run the application
}
func newWatcher() watcher {
w := watcher{}
go w.watch()
return w
}
type watcher struct { /* Some resources */
}
func (w watcher) watch() {}
func (w watcher) close() {
// Close the resources
}