UnnoTed / fileb0x

a better customizable tool to embed files in go; also update embedded files remotely without restarting the server
MIT License
634 stars 53 forks source link

Generate function to return a slice of filenames #1

Closed andreynering closed 8 years ago

andreynering commented 8 years ago

The same as AssetNames function in go-bindata.

My use case is compiling templates inside the file:

for _, filename := range filebox.FileNames() {
    data, err := filebox.ReadFile(filename)
    if err != nil {
        log.Fatal(err)
    }
    // compile template file here
}
UnnoTed commented 8 years ago

Hey, before merging i would like some things.

  1. Make it a variable instead, as creating a new slice every time is bad.
  2. Use {{exportedTitle "VariableNameHere"}} so it can be un-exported in case the user wants it to, use exported instead of exportedTitle if the variable name is all caps.
  3. Provide a comment so it can be golint safe.

Ignore CI errors, i'll fix that later :blush:

edit: Keep in mind it will not show new files on the list unless you implement it to WriteFile

andreynering commented 8 years ago

@UnnoTed Thank you for the fast review. Updated.