Skip to content

Commit

Permalink
Support for go mod
Browse files Browse the repository at this point in the history
  • Loading branch information
zenthangplus committed Oct 5, 2021
1 parent 39e9e08 commit 2f2e522
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package main

import (
"fmt"
"goccm"
"github.com/zenthangplus/goccm"
"time"
)

Expand All @@ -27,20 +27,20 @@ func main() {

for i := 1; i <= 10; i++ {

// This function have to call before any goroutine
// This function has to call before any goroutine
c.Wait()

go func(i int) {
fmt.Printf("Job %d is running\n", i)
time.Sleep(2 * time.Second)

// This function have to when a goroutine has finished
// This function has to when a goroutine has finished
// Or you can use `defer c.Done()` at the top of goroutine.
c.Done()
}(i)
}

// This function have to call to ensure all goroutines have finished
// This function has to call to ensure all goroutines have finished
// after close the main program.
c.WaitAllDone()
}
Expand All @@ -51,7 +51,7 @@ func main() {
```go
package main

import "goccm"
import "github.com/zenthangplus/goccm"

func main() {
// Create the concurrency manager
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/zenthangplus/goccm

go 1.14

0 comments on commit 2f2e522

Please sign in to comment.