Solution 5: Go Concurrency

Let’s solve the challenge set in the previous lesson.

We'll cover the following

Solution

To modify wPools.go so that each worker implements the functionality of wc(1), we can replace the calculation of the square with a call to the wc command-line tool using Go’s built-in os/exec package.

Here’s the modified code:

Get hands-on with 1400+ tech skills courses.