去,没有得到字符串值

package main

import (
    "fmt"
    "io/ioutil"
)

func main() {

    // Just count the files...
    systems,_ := ioutil.ReadDir("./XML")
    fmt.Printf("# of planetary systems\t%d
", len(systems))

    // For each datafile
    for _,element := range systems {
        fmt.Println(element.Name)
    }

}

This line...

fmt.Println(element.Name)

Is outputting a memory address instead of what I assume to be the filename string. Why? How do I get the actual string? Thanks.

Also all the addresses are the same, I would expect them to difer, meaning my for-each loop might be broken.

FileInfo.Name is a function of the FileInfo interface; the function's memory address is being printed. To display the name of the file, you need to evaluate the function before printing:

for _, element := range systems {
    fmt.Println(element.Name())
}