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

22 lines
329 B
Go

package main
import "context"
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
newWatcher(ctx)
// Run the application
}
func newWatcher(ctx context.Context) {
w := watcher{}
go w.watch(ctx)
}
type watcher struct { /* Some resources */
}
func (w watcher) watch(context.Context) {}