fix golint issues in core/threading (#524)

This commit is contained in:
Kevin Wan
2021-02-26 16:27:04 +08:00
committed by GitHub
parent f309e9f80c
commit ad32f9de23
5 changed files with 11 additions and 3 deletions

View File

@@ -1,10 +1,12 @@
package threading
// A WorkerGroup is used to run given number of workers to process jobs.
type WorkerGroup struct {
job func()
workers int
}
// NewWorkerGroup returns a WorkerGroup with given job and workers.
func NewWorkerGroup(job func(), workers int) WorkerGroup {
return WorkerGroup{
job: job,
@@ -12,6 +14,7 @@ func NewWorkerGroup(job func(), workers int) WorkerGroup {
}
}
// Start starts a WorkerGroup.
func (wg WorkerGroup) Start() {
group := NewRoutineGroup()
for i := 0; i < wg.workers; i++ {