So I’m trying to learn golang and i started with an api rest project but I’m kinda lost with good practices. I tried to follow everything i’ve found to do a decent project. Thanks!
#First project in go, can i get some feedback?
11 messages · Page 1 of 1 (latest)
I dislike your module names. they feel java-y. for example I think I would like the domain/ folder be named to be named models, because even in for example your profile_handler.go file, you're renaming the package to models. something to think about
also i just posted this in the other channel but https://laurentsv.com/blog/2024/10/19/no-nonsense-go-package-layout.html may apply to u
It’s a recurring question on gopher slack and discord: «How should I set up my go project repository?». Unfortunately, there are a lot of both outdated and o...
That’s on me for sure.. excluding some low-level projects with c, I’ve always been a Java guy hahaha. So thank you so much for the feedback and that resource you sent, I’ll check it out!
it's a very common thing for people coming from other languages. u wanna structure stuff the same way u have been. here's another good resource (I think, I haven't watched it but one of the herders recommended it to someone else so)
https://youtu.be/cAWlv2SeQus?si=RTYiI69VAxPlxN8p
Whether for internal use, or destined for open-source stardom, writing good packages with clean and clear APIs will greatly increase the chance that the code is used and reused. Explore best practices, goals, and idioms that help make beautiful packages.
though this is more for packages rather than the whole of the program. but still applies to subpackages in ur program
Nice, thanks again!
I noticed that you are using an HTTP Header for authorization using jwt. If the client is a web-application it is better to save the jwt to a cookie, because a cookie is more secure then localstorage in the browser.
in general JWTs make me nervous
Noted thanks
Eventually I’ll go with smh more serious, for a first project i wanted to keep it simple and focus on learning go basics haha