I'm using the following struct on my project, but it feels hacky
App
├── go.mod
├── app.go
└── src
└── foo
| └── foo.go
└── bar
└── bar.go
Is there a way to organize it like that?
App
├── go.mod
└── src
├── app.go
└── foo
| └── foo.go
└── bar
└── bar.go
You could just move the app.go
file into the src directory.
However, it's generally ill-advised to have an src folder in a Go project. I recommend you take a look here for recommendations re: project structure.
I like the following structure
App
├── makefile
├── go.mod
├── httpd <- Entrypoint is here - CLI or Http Server
| └── main.go
└── platform <- Project specific dependencies that are not shared between projects
e.g
App
├── makefile
├── go.mod
├── httpd
| └── handlers
| | └── hello-world_get.go
| | └── hello-world_get_test.go
| └── main.go
└── platform
└── user
└── user.go
└── user_test.go
I describe it here on YouTube https://youtu.be/zeme_TmXyBk