This recipe gives you a hint on how to compare two files. The recipe will show you how to quickly determine whether the files are identical. The recipe will also present you with a way to find differences between the two.
Comparing two files
How to do it...
- Open the console and create the folder chapter06/recipe09.
- Navigate to the directory.
- Create the comparison.go file with the following content:
package main
import (
"bufio"
"crypto/md5"
"fmt"
"io"
"os"
)
var data = []struct {
name string
cont string
perm os.FileMode
}{
{"test1.file", "Hello...