https://github.com/spy16/droplets
This project is far from complete. Would like to hear some feedback from the community before continuing on this.
1–10 of 18 posts
https://github.com/spy16/droplets
This project is far from complete. Would like to hear some feedback from the community before continuing on this.
Every single Go program starts with a simple layout - empty directory and main.go file.
Once you start adding things, you create more .go files in the same folder, and only when it grows bigger you start thinking of moving some abstractions into separate packages.
The key difference with most other languages is that in Go folder means "package", not "namespace for bunch or files". It's a crucial difference that important to keep in mind with Go. And what is (sub)package? When do you need new subpackage? It's just a higher level way to abstract logic or system component - make it more isolated than just concrete type, change the naming and usage API to be more clear and self-sustained.
Before that, you don't have to create new packages (=folders) in Go.
The vast majority of all Go projects will never need `internal` or `cmd` folder, not to mention `pkg` or `web`.
Just start with main.go and let it grow naturally. The simpler and easier your package is, the better.
Nice work i really like it
Thanks, I started learning golang few weeks ago, and had a problem with how to structure my code.
I really appreciate the work done to help newcomers to answer the question "how to structure Go project propertly", but unless you're building N-th microservice in the company with already established project structures, you don't really need to ask that question. Every single Go program starts with a simple layout - empty directory and main.go file. Once you start adding things, you create more .go files in the same…
I'm creating a web service with Gin, and I have moved each http request handler into its own file. I would like to be able to pass these request handlers to Gin's router with pageA.Handler, pageB.Handler, pageC.Handler, etc, but compiler won't let me because function names have to be unique. Creating unique names for each handler function works fine, but personally it somehow feels messy.
Am I thinking anti-golang way, if I want to namespace these request handlers?
I really appreciate the work done to help newcomers to answer the question "how to structure Go project propertly", but unless you're building N-th microservice in the company with already established project structures, you don't really need to ask that question. Every single Go program starts with a simple layout - empty directory and main.go file. Once you start adding things, you create more .go files in the same…
I really appreciate the work done to help newcomers to answer the question "how to structure Go project propertly", but unless you're building N-th microservice in the company with already established project structures, you don't really need to ask that question. Every single Go program starts with a simple layout - empty directory and main.go file. Once you start adding things, you create more .go files in the same…
When using a single folder structure, how should one go about creating multiple functions with a same name? I'm creating a web service with Gin, and I have moved each http request handler into its own file. I would like to be able to pass these request handlers to Gin's router with pageA.Handler, pageB.Handler, pageC.Handler, etc, but compiler won't let me because function names have to be unique. Creating unique nam…