Probably should use os.Stat instead, especially because you are throwing away the file handle and thus never close it.