Creating Multiple Files with Goroutines

Let’s learn how to use goroutines to create multiple files with random data using a Go command-line utility.

The randomFiles.go utility

As a practical example of the use of goroutines, this lesson presents a command-line utility that creates multiple files populated with randomly generated data—such files can be used for testing file systems or generating data used for testing.

Coding example

The crucial code of randomFiles.go is the following:

Get hands-on with 1200+ tech skills courses.