mirror of
https://github.com/teivah/100-go-mistakes.git
synced 2026-06-21 00:47:11 +08:00
22 lines
329 B
Go
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) {}
|