func worker(data interface{}) bool {
	if job, ok := data.(JobData); ok {
		fmt.Printf("processing %v\npicture: %v\n\n", job.Name, job.PictureFilePath)
		time.Sleep(1 * time.Second)
		fmt.Printf("\n'%v' was processed\n", job.Name)
		return true
	}
	return false
}
worker is the function each worker will invoke to process jobs
package main
import (
	"fmt"
	"time"
	"github.com/enriquebris/goworkerpool"
)
type JobData struct {
	Name            string
	PictureFilePath string
}
func main() {
	var (
		totalWorkers uint = 10
		maxNumberPendingJobs uint = 150
		verbose = false
	)
	pool, err := goworkerpool.NewPoolWithOptions(goworkerpool.PoolOptions{
		TotalInitialWorkers:          totalWorkers,
		MaxOperationsInQueue:         maxNumberPendingJobs,
		MaxWorkers:                   20,
		WaitUntilInitialWorkersAreUp: true,
		LogVerbose:                   verbose,
	})
	if err != nil {
		fmt.Println(err)
		return
	}
	pool.SetWorkerFunc(worker)
	go func() {
		for i := 0; i < 30; i++ {
			pool.AddTask(JobData{
				Name:            fmt.Sprintf("John-%v", i+1),
				PictureFilePath: fmt.Sprintf("/pictures/john-%v", i+1),
			})
		}
		pool.LateKillAllWorkers()
	}()
	pool.Wait()
}