Golang-发出信号通知其他goroutine停止并在一个goroutine找到结果后返回

I would like to speed up a certain task in Go by starting several worker goroutines.

In the example below, I'm looking for a "treasure". Worker goroutines that are started will dig forever for items until they are told to stop. If the item is a wanted treasure, then it is placed onto a shared buffered channel with a capacity equals to the number of workers.

The program is only interested in getting one treasure. It also has to make sure that all workers goroutines will return and not be blocked forever.

The example works, but is there a cleaner or more idiomatic way to ensuring the above?

package main

import (
    "fmt"
    "math/rand"
    "sync"
    "time"
)

var wg sync.WaitGroup

func digTreasure() int {
    time.Sleep(5 * time.Millisecond)
    return rand.Intn(1000)
}

func worker(i int, ch chan int, quit chan struct{}) {
    defer func() {
        fmt.Println("worker", i, "left")
        wg.Done()
    }()
    for {
        treasure := digTreasure()
        if treasure%100 == 0 {
            fmt.Println("worker", i, "found treasure", treasure)
            ch <- treasure
            return
        }

        select {
        case <-quit:
            fmt.Println("worker", i, "quitting")
            return
        default:
        }
    }
}

func main() {
    rand.Seed(time.Now().UnixNano())

    n := 10
    ch, quit := make(chan int, n), make(chan struct{})
    fmt.Println("Searching...")

    wg.Add(n)
    for i := 0; i < n; i++ {
        go worker(i, ch, quit)
    }
    fmt.Println("I found treasure:", <-ch)
    close(quit)
    wg.Wait()
    fmt.Println("All workers left")
}