Locate substrings within a file
You're reading the file into memory inefficiently. I can't write the full code currently, but here's the gist:

Instead, use the ioutil package: func ReadFile(filename string) ([]byte, error).

Once you've read the file into a byte array, you can remove extraneous characters (newlines, invalid characters, etc). One way is to use bytes.Replace with n of -1.

Then, you can search the byte array using the bytes package: func Count(s, sep []byte) int.



Also, if you want to correctly time a function, use the testing package.