Code:
files, err := ioutil.ReadDir(".")
elements := make(map[string]interface{})
for _, file := range files {
elements["name"] = file.Name()
elements["directory"] = file.IsDir()
elements["size"] = file.Size()
}
ctxt.JSON(http.StatusOK, elements)
Here I'm getting a response with only last file details.
How can I create a slice of objects, that means I want all files details in the response.