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
rice embed-go does not seem to find code is subfolders. I'm building a small web app using templates and some static files.
Main.go is in the root and my handlers are all in a handlers folder. If I run rice embed-go, it finds any resources I reference in the main.go just fine. If I scan the rice-box.go, I have lots of stuff there. And it all works as expected.
But, I cannot get it to find files I reference from my handlers in the subfolder. i.e. if I call tBox, err := rice.FindBox("templates") in a handler, they do not show up in the rice-box.go file. No errors until I execute the binary on a separate system. Then it blows up on a nil pointer.
To get it to work, I have to construct the Box twice. Once in the handler so I can use it. And once in the main.go so the embedded can find it. And in the handler, I have to call it with a relative "../name" to find it from the handlers folder. Unless I have it swapped in a separate func when suddenly it doesn't need the relative path anymore. But the func is also defined in the handlers folder?.?
I can get it to work. But I really would like to understand why it's like this. It seems very strange.
The text was updated successfully, but these errors were encountered:
It's a great tool. But I'm struggling a bit...
rice embed-go
does not seem to find code is subfolders. I'm building a small web app using templates and some static files.Main.go is in the root and my handlers are all in a
handlers
folder. If I runrice embed-go
, it finds any resources I reference in themain.go
just fine. If I scan therice-box.go
, I have lots of stuff there. And it all works as expected.But, I cannot get it to find files I reference from my handlers in the subfolder. i.e. if I call
tBox, err := rice.FindBox("templates")
in a handler, they do not show up in therice-box.go
file. No errors until I execute the binary on a separate system. Then it blows up on a nil pointer.To get it to work, I have to construct the Box twice. Once in the handler so I can use it. And once in the main.go so the embedded can find it. And in the handler, I have to call it with a relative "../name" to find it from the handlers folder. Unless I have it swapped in a separate func when suddenly it doesn't need the relative path anymore. But the func is also defined in the handlers folder?.?
I can get it to work. But I really would like to understand why it's like this. It seems very strange.
The text was updated successfully, but these errors were encountered: