I’ve started playing with Go today, just understood the basics and still a bit confused about the module and goroutine parts.
I’ll try to make something interesting soon.
@justamoment@twtxt.net I haven’t touched the goroutines yet (I played with these like 10 years ago), but I haven’t found a case where I need these.
About the modules, those were very non-intuitive to me, coming from Python, C#, and JS. I think the official documentation from Go is not clear enough and has no simple examples…
After a few searches, I reached Stack Overflow and blogs with tips for Modules and subdirectories. Now, I can replicate an MVC model with templates.
This project helped a lot: https://github.com/J7mbo/go-subdirectories-with-modules
@eaplmx@twtxt.net Thank you so much.
I got the fact that everything get bundled from a single folder but I too am used to properly specify what I want for every module since using Python/JS.
On my tries I managed to do local imports and compile with GO111MODULES
but I was confused on the uses of that flag. Online everything mentioned the url as a reference to the source and I was missing the point of using it locally from a single project.
On a post the recommendation was to not use folder which is pretty bad in my opinion for a bigger project, also looking at yarn repo didn’t cleared up my doubts (too big for me right now 😓).
Thanks again!
@lyse@lyse.isobeef.org this is what confused me the most. But also Python is confusing in this case.
Java does a good job here with the packages.
Go, when you develop outside the gopath, can get as you described, weird too
@prologic@twtxt.net ahh ok. Do you can now use local relativ air absolute path‘s? that was not possible before iirc
@prologic@twtxt.net I’m missing something here, does this allow to remap a local module with it, or is just a reference for the whole project/module locally?
@justamoment@twtxt.net I found that part is well documented 🙂
So, to understand the theory I started here
https://go.dev/blog/using-go-modules
And a few explanations in SO helped me to practice it in my project:
https://stackoverflow.com/a/57314494
@eaplmx@twtxt.net @prologic@twtxt.net Thanks! 👍
Seems like it worked flawlessly, once I tried everything went in place.
The only thing I noticed is that the libraries didn’t auto-installed like in the documentation, they say to run a go get LIBRARY
but after that it’s all good.
I have to try making something now.
@prologic@twtxt.net yes I discovered first hand. 😎
@prologic@twtxt.net the go get
and go mod tidy
wont fetch new changes. that’s all a manual affair AFAIK
ahh this is useful https://go.dev/doc/modules/managing-dependencies. the go culture doesn’t typically have large dependency graphs like Ruby or JS.