This project contains some exercises to practice Reading, Writing, Creating, Copying, and some more use cases when handling files with Go.
- pathExists/: Check if a given path truly exists.
- isFile/: Check if a given path is a regular file.
- isDirectory/: Check if a given path is a directory.
- readFull/: Read a complete file at once .
- readByLine/: Read a file line by line.
- readByWord/: Read a file word by word.
- readByChar/: Read a file character by character.
- createFile/: Program for creating a new file.
- copyFile/: Program to create a new file as a copy of another one.
- writeFile/: Program for creating a file and writing some data within.
- appendData/: Program for adding some new data in an existing file.
- catData/: Program for printing on the terminal the content of a file.
You can always use the ./tmp/data.txt file when testing the programs.
If you are beginning to learn Go, I recommend you to first check the basic Golang repos I have built to lay the foundation. Then come back and check these programs:
Thanks to Linode for the amazing article explaining these exercises. You can check the article here.