Writing to a File

Let’s learn how to write data to files.

How to write data to files

So far, we have seen ways to read files. This lesson shows how to write data to files in four different ways and how to append data to an existing file.

Coding example

The code of writeFile.go is as follows:

Get hands-on with 1400+ tech skills courses.