Do you remember the keyValue.go application from Chapter 4, The Uses of Composite Types? Well, it was far from perfect, so in this section you will learn how to save the data of a key-value store on disk and how to load it back into memory when you next start your application.
We are going to create two new functions, one named save() for saving data to disk and another named load() for retrieving the data from disk. Thus, we will only present the code differences between keyValue.go and kvSaveLoad.go using the diff(1) UNIX command-line utility.
The diff(1) UNIX command-line utility can be very convenient when you want to spot the differences between two text files. You can learn more about it by executing man 1 diff at the command line of your favorite UNIX shell.
If you think about the task to be implemented here, you will recognize that what...