Today we will create a very basic application to read content from a file, and write the content from the file back to disk, but to another filename.
Basically, doing a copy of the file to another filename.
Golang Environment: Golang Docker Image
Dropping into a Golang Environment using Docker:
Our Golang Application
After we are in our container, lets write our app:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Building our application to a binary:
Running the Golang App:
When we run this app, it will read the content of
source-data.txt and write it to
We can see that the file has been written to disk:
1 2 3
Making sure the data is the same, we can do a
md5sum hash function on them:
1 2 3 4 5
This was a very static way of doing it, as you need to hardcode the filenames. In the next post I will show how to use arguments to make it more dynamic.