mirror of
https://github.com/chai2010/advanced-go-programming-book.git
synced 2025-05-24 12:32:21 +00:00
ch-1:06修正例子代码异常缩进
This commit is contained in:
parent
224cd6bf5c
commit
ff0aa76fc1
@ -567,7 +567,7 @@ func main() {
|
||||
func worker(cannel chan bool) {
|
||||
for {
|
||||
select {
|
||||
default:
|
||||
default:
|
||||
fmt.Println("hello")
|
||||
// 正常工作
|
||||
case <-cannel:
|
||||
@ -591,7 +591,7 @@ func main() {
|
||||
func worker(cannel chan bool) {
|
||||
for {
|
||||
select {
|
||||
default:
|
||||
default:
|
||||
fmt.Println("hello")
|
||||
// 正常工作
|
||||
case <-cannel:
|
||||
@ -620,7 +620,7 @@ func worker(wg *sync.WaitGroup, cannel chan bool) {
|
||||
|
||||
for {
|
||||
select {
|
||||
default:
|
||||
default:
|
||||
fmt.Println("hello")
|
||||
case <-cannel:
|
||||
return
|
||||
@ -863,10 +863,10 @@ func worker(ctx context.Context, wg *sync.WaitGroup) error {
|
||||
|
||||
for {
|
||||
select {
|
||||
default:
|
||||
default:
|
||||
fmt.Println("hello")
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
return ctx.Err()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user