I am new in golang, so I apologize if this is just basic ignorance, but my problem is this:
I am not sure if this is supported, or am I not allowed to create subfolders in the given folder structure.
Steps to Reproduce the Problem
I use the command to generate an action in a subfolder with:
The command runs without a problems, files get generated where I expect them to be.
I expect the new route to lead to my new action
But I get an error when I try to start the dev server:
Creating sub-folders in your action folder is not the best idea that you can have as a begginer, even though it's possible. In Go to be in the same package the code should be in the same folder (subfolder are not considered as in the same folder). So creating sub-folders in your action folder have a lot of implication and buffalo don't take them into account. So for beginning I'll recommend you not to create those sub-folders. But it's still very easy to have the route localhost:3000/superfly/foobars in your path. You just have to edit the models/app.go with the route you want to have.
As a new comer to go I also recommend you to play a bit with generate resources so you can see some code for some handlers for basic functions (you need to have a db).
Yeah, I thought that might be the case... :/
Just having all actions in the same folder will make it very crowded very quickly. How would you recommend scaling this?
I like having a lot of very small controllers (or actions) organized in some sort of hierarchy, or use a DDD approach where code is separated into folders by the domain logic feature they belong to, and then each folder having it's own actions/models/etc folders.
I guess I should be able to create a new package for each folder under actions, and then import the actions into
It depends. If it's only small controllers with not a big number of them, personally I'll replace the folder by one file and include multiple handler in it (I don't know how many you have for each folder, if you have 20 for each yeah it might be a mess).
But yeah an other approach will be to import the various actions in the main app file.
As I said try to use generate resources and look how the code structures look like.