如何在Go中将Map传递给回调函数

I am trying to write a Go program to walk down a directory and find certain file and store that information in a Map. Here is what I have so far. I am not sure how to pass the Map to the visit function since it's a callback function.

..
type MyFile struct {
    Name       string
    FilePath    string
    FileMD5Hash [16]byte
}

func visit(path string, f os.FileInfo, err error) error {

    fileName := f.Name()
    if !f.IsDir() && strings.Contains(strings.ToLower(fileName), "myfile") {
        df := parseFile(path)
        fmt.Printf("Visited: %s [%x], %s, %s
", df.FilePath)
    }

    return nil
}

func parseFile(path string)...

func check(e error) ...

func WalkDir(path string) {
    err := filepath.Walk(path, visit)
    fmt.Printf("filepath.Walk() returned %v
", err)
}

Pass the Map to the function which returns a filepath.WalkFunc and then pass it to filepath.Walk. It is a constructor like thing.

func visit(map Map) filepath.WalkFunc {
    return func(path string, f os.FileInfo, err error) error {

        // do something with map

        fileName := f.Name()
        if !f.IsDir() && strings.Contains(strings.ToLower(fileName), "myfile") {
            df := parseFile(path)
            fmt.Printf("Visited: %s [%x], %s, %s
", df.FilePath)
        }

        return nil
    }
}

func WalkDir(path string) {
    err := filepath.Walk(path, visit(map))
    fmt.Printf("filepath.Walk() returned %v
", err)
}

You can write

func (map Map) visit(path string, f os.FileInfo, err error) error {
...//Do something with map 
}
var mymap Map

err := filepath.Walk(path, mymap.visit) //mymap.visit express 'func(path string, f os.FileInfo, err error) error' same as visit just with mymap evaluated

it's called method value