youtuber-description-links
youtuber-description-links copied to clipboard
Need to abstract the business logic from services in modules.
You should use some file structure and separe, in modules, which implementation.
I would sujest to use pkg and cmd.
cmd/
There is the clients, that consumes the application API.
pkg/
There is the application with each module.
Example
cmd/
cli/
main.go
pkg/
youtube/
repo.go
application/
app.go
video/
video.go
description.go
interfaces.go
in the cmd/cli/main.go should be something like that.
package main
import (
"module.org/pkg/application"
"os"
)
func main() {
application.run(os.Args)
}
You should use some file structure and separe, in modules, which implementation.
I would sujest to use pkg and cmd.
cmd/ There is the clients, that consumes the application API. pkg/ There is the application with each module.
Example
cmd/ cli/ main.go pkg/ youtube/ repo.go application/ app.go video/ video.go description.go interfaces.go
in the cmd/cli/main.go should be something like that.
package main import ( "../../pkg/application" "os" ) func main() { application.run(os.Args) }
Dont u use models package?
And why dont u use the full path to packages? (Cause ur using "../" paths)
Yep. Using module is a lot better. I'm gonna edit it.
You should use some file structure and separe, in modules, which implementation. I would sujest to use pkg and cmd.
cmd/ There is the clients, that consumes the application API. pkg/ There is the application with each module.
Example
cmd/ cli/ main.go pkg/ youtube/ repo.go application/ app.go video/ video.go description.go interfaces.go
in the cmd/cli/main.go should be something like that.
package main import ( "../../pkg/application" "os" ) func main() { application.run(os.Args) }
Dont u use models package?
Inside the application.go and repository you use the model. But the main.go inside the web directory only consumes the application(application.go).
It's a good pratice in Go. A lot of go projects use this structure.
It's a good pratice in Go. A lot of go projects use this structure.
Hmmm ill try it, thanks!