You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello.
So when I use Walk() I get different path names depending on if I have embedded/appended the files, to the compiled binary, or not. Example code:
templatebox := rice.MustFindBox("templates")
templates := template.New("ServerTemplates")
templatebox.Walk("/", func(p string, i os.FileInfo, e error) error {
if i.IsDir() {
return nil
}
s, e := templatebox.String(p)
if e != nil {
log.Fatalf("Failed to load template: %s\n%s\n", p, e)
}
template.Must(templates.New(p).Parse(s))
return nil
})
fmt.Println("Loaded templates:")
for _, t := range templates.Templates() {
fmt.Println(t.Name())
}
Normal output is something like:
base.html
index.html
But when I embedd/append I get:
/base.html
/index.html
Took a while for me to notice that difference when my app broke, since it can't load files prefixed with /.
It's easily solved by calling Walk("", ... instead, but thought I should report this bug anyway. I guess it's an oversight in readDirNames().
The text was updated successfully, but these errors were encountered:
Hello.
So when I use
Walk()
I get different path names depending on if I have embedded/appended the files, to the compiled binary, or not. Example code:Normal output is something like:
But when I embedd/append I get:
Took a while for me to notice that difference when my app broke, since it can't load files prefixed with
/
.It's easily solved by calling
Walk("", ...
instead, but thought I should report this bug anyway. I guess it's an oversight inreadDirNames()
.The text was updated successfully, but these errors were encountered: