package
0.0.0-20240122201314-a58f6c6a0d38
Repository: https://github.com/soypete/production-go-examples.git
Documentation: pkg.go.dev

# README

Build a worker pool

Using the template provided in main.go build a worker pool using what you learned about go channels and goroutines. This example will accept a number of workers as a flag --workers and then use the workers to perform a task. It should take between 10-15 min?

Step 1 build the worker pool

Fill in the func (wp *workerPool) run() to queue up the amount of workers input via command line arguments.

Step 2 running your code

You can run the following exercise code locally with the following command.

go run main.go --workers=2 

Follow-up questions:

  • is this a parallel or concurrent process?
  • do we need channels and go routines to write this program? What are advantages and disadvantages?
  • did your linter suggest any code improvements while you were writing this solution?