I am not sure if I am doing this correctly, but ultimately I would like to find the most recent modified date of a file in a directory and return the file name. The code I have so far is as follows. Can someone please help me with a more efficient solution than this. I really have a feeling this is super hacky. What I am doing is getting the dates and removing the

package main

import (
    "fmt"
    "io/ioutil"
    "os"
    "strconv"
    "strings"
)

func main() {
    dir := "C:\\temp\\"
    files, _ := ioutil.ReadDir(dir)
    for _, f := range files {
        fi, _ := os.Stat(dir + f.Name())
        s := strings.Split(fi.ModTime().Format("2006-01-02 15.04.05.000"), " ")

        fdate, err := strconv.Atoi(strings.Replace(s[0], "-", "", -1))
        if err != nil {
            fmt.Println(err)
        }

        ftime, err := strconv.Atoi(strings.Replace(s[1], ".", "", -1))
        if err != nil {
            fmt.Println(err)
        }
        fmt.Println(fi.Name(), fdate+ftime)
    }

}