feat: add semaphore

main
sudo pacman -Syu 2022-10-26 21:43:15 +07:00
parent 0ffbcde1c3
commit 52c4b9f3ad
No known key found for this signature in database
GPG Key ID: D6CB5C6C567C47B0
2 changed files with 5 additions and 1 deletions

View File

@ -61,7 +61,7 @@ eg.Go(func() error {
if err := eg.Wait(); err != nil {
// Handle error
}
</code></pre><h2>External libs</h2><h3>No need <code>vendor</code></h3><p>Only need if you need something from <code>vendor</code>, to generate mock or something else.<h3>Use <code>build.go</code> to include build tools in go.mod</h3><p>To easily control version of build tools.<p>For example <code>build.go</code>:<pre><code class=language-go>//go:build tools
</code></pre><h3>Use <a href=https://pkg.go.dev/golang.org/x/sync/semaphore>semaphore</a> when need to implement WorkerPool</h3><p>Please don't use external libs for WorkerPool, I don't want to deal with dependency hell.<h2>External libs</h2><h3>No need <code>vendor</code></h3><p>Only need if you need something from <code>vendor</code>, to generate mock or something else.<h3>Use <code>build.go</code> to include build tools in go.mod</h3><p>To easily control version of build tools.<p>For example <code>build.go</code>:<pre><code class=language-go>//go:build tools
// +build tools
package main

View File

@ -142,6 +142,10 @@ if err := eg.Wait(); err != nil {
}
```
### Use [semaphore](https://pkg.go.dev/golang.org/x/sync/semaphore) when need to implement WorkerPool
Please don't use external libs for WorkerPool, I don't want to deal with dependency hell.
## External libs
### No need `vendor`