Use tabs as the canonical source indentation in git

Space conversion is done during generation only. Fixes #192
This commit is contained in:
Eli Bendersky
2019-06-01 06:04:32 -07:00
committed by Mark McGranaghan
parent 1699ad1c45
commit 7c160440be
152 changed files with 1929 additions and 1939 deletions

View File

@@ -4,39 +4,39 @@
package main
import (
"fmt"
"sync"
"time"
"fmt"
"sync"
"time"
)
// This is the function we'll run in every goroutine.
// Note that a WaitGroup must be passed to functions by
// pointer.
func worker(id int, wg *sync.WaitGroup) {
fmt.Printf("Worker %d starting\n", id)
fmt.Printf("Worker %d starting\n", id)
// Sleep to simulate an expensive task.
time.Sleep(time.Second)
fmt.Printf("Worker %d done\n", id)
// Sleep to simulate an expensive task.
time.Sleep(time.Second)
fmt.Printf("Worker %d done\n", id)
// Notify the WaitGroup that this worker is done.
wg.Done()
// Notify the WaitGroup that this worker is done.
wg.Done()
}
func main() {
// This WaitGroup is used to wait for all the
// goroutines launched here to finish.
var wg sync.WaitGroup
// This WaitGroup is used to wait for all the
// goroutines launched here to finish.
var wg sync.WaitGroup
// Launch several goroutines and increment the WaitGroup
// counter for each.
for i := 1; i <= 5; i++ {
wg.Add(1)
go worker(i, &wg)
}
// Launch several goroutines and increment the WaitGroup
// counter for each.
for i := 1; i <= 5; i++ {
wg.Add(1)
go worker(i, &wg)
}
// Block until the WaitGroup counter goes back to 0;
// all the workers notified they're done.
wg.Wait()
// Block until the WaitGroup counter goes back to 0;
// all the workers notified they're done.
wg.Wait()
}