GO CONTENT IS AWESOME! I HOPE YOU ALL ENJOY IT. MAKE SURE TO COMMENT AND SUBSCRIBE- it really means the world
@PeterPatrick-uq5ef11 ай бұрын
Melky, what do you advise, I just started learning Go as I am new to software dev world, but some what seem confusing sometimes. Topic like Pointers; I am struggling to really understand it deeply, and a few others. Can you advice on howto go about it - recommend materials that can easily break it down for me. I am really interested in learning getting as far as building API's, Micro-services. I know that for a newbie, it seem like a daunting task; i do believe i can achieve it. I am not totally new to IT world, I have worked as a network engineer, and now looking to become a software engineer; Specifically a back-end or full stack. I do have a bit of the basic knowledge of variables, functions, struct, boolean, integer, float etc. i know basic python programming, html, css , docker, i use vagrant as IAC for my private test environment, Linux, basic knowledge of Git & Github, cloud services - aws cloud services, Splunk enterprise software installlation, monitoring and for onboarding data. I will appreciate your sincere advice? Thank you very much.
@PeterPatrick-uq5ef11 ай бұрын
And if you could recommend a good trainer that can help with other programming language(JS, Java..etc) along with Go, I will be most grateful
@Chronofrost00110 ай бұрын
I have been a C# dev for over 15 years and wanted to try something else so a few days ago i picked up a GO course. This video has been a great addition to the other things i have. Thanks.
@agentbabs_yt Жыл бұрын
Absolute lifesaver.. I was struggling with getting local imports to work after a tutorial refactored code into subdirectories. thank you for this!
@MelkeyDev Жыл бұрын
My pleasure boss - glad you enjoyed
@mrjson3039 Жыл бұрын
3 days ago I started my journey as a go developer. I wanted to learn something new and since I can't find work with my current knowledge of js I decided give a GO haha. This type of content is invaluable for me, thanks Melkey.
@MelkeyDev Жыл бұрын
Wonderful!
@viktorkrepak8 ай бұрын
Well structured video without any water, thanks for your work Melkey!
@MelkeyDev8 ай бұрын
Absolutely, hope you enjoy it !
@douglaspiresmartins2955Ай бұрын
Hi, excellent vid Melkey. We can say that "internal" folder would be the High-Level modules, the code that organization CARES about, the business logic itself. For "pkg" would be the "Low-level modules" the code that the organization does not care about.
@alexandersemionov5790 Жыл бұрын
ok, have to admit - this was useful. I just started going deeper in Go and was missing the point of long import statements. Genuine thank you
@MelkeyDev Жыл бұрын
Excellent!
@georgejoseph26019 ай бұрын
This is why more people need experience with battle-tested monolithic frameworks like Rails or Django
@MelkeyDev8 ай бұрын
Why
@krislui852 Жыл бұрын
just started on go recently and struggling with structuring my project. watched a couple videos on that but seems like opinions are quite contradicting. anyway, great walkthrough, helps a lot
@Doomdave1992 Жыл бұрын
Enjoying the content Melkey! I don’t code in Go at all but watching these makes it feel like I could do it tomorrow
@MrKeliv Жыл бұрын
When I create go project. I always follow MVC like PHP framework folders. - routes -> routes.go - models -> post.go - databases -> database.go - controllers -> post_controllers.go, etc - views -> - layouts -> layout.html - pages -> home.html, about,html, etc - middlewares -> auth.go main.go go.mod I dont know its good or bad. But it make easier for me to trace something and so familiar with other projects with different languages.
@dan_le_brown11 ай бұрын
I'd do the same too
@matthewrossee11 ай бұрын
It sucks because you're grouping by technical concerns. It's better to group by a feature because it's more cohesive and functionality related to "post" isn't scattered all over the project. Your project structure should tell what the application is about.
@myfamily250311 ай бұрын
@@matthewrosseeI will do with inherit in all codes. Sometimes we need nested feature. So I will include in same folder but tell what about of this file. Ex. models -> post_comment.go controllers -> post_comment_controllers.go pages -> post_comment.html
@krskvBeatsRadio10 ай бұрын
@matthewrossee you have a point but what if your application has only one feature? Then all files would end up in one folder creating a total mess I think such grouping is much better suited for non-microservice project
@gearboxworks9 ай бұрын
Not good, because directory=package in Golang, and that means you are grouping code that should be in the same package into different packages and that can create all kind of unnecessary complexity like import cycles and then interfaces needed *just* to resolve import cycles. Think this rule of thumb: If you were to extract any given functionality to use in another app, what files would you need? All those files should then be kept in the same directory/package.
@henrikchristensen65688 Жыл бұрын
Wait... what? Tests in a separate folder? 😳
@GustavoDiaz93 Жыл бұрын
Mmm first time I see this recommendation, in Go we tend to have the test files next to the code we’re testing.
@henrikchristensen65688 Жыл бұрын
@@GustavoDiaz93 yeah
@gearboxworks9 ай бұрын
@@GustavoDiaz93- Apples and oranges. Units tests in the same directory, integration tests in a ./test directory.
@chandup8 ай бұрын
I see an advantage (there might be better approaches too): - if you want to ignore tests while building final go application container image. This reduces your final code base you are delivering. Just use test files for dev & testing phase. But for easy human consumption when looking at code base, test folder should follow the same structure as main code base, so that it’s easy to relate the relationships between folders and test files to the main code base folders and code files. Maybe someone here can provide more insights.
@呀咧呀咧2 ай бұрын
@@gearboxworksYeah
@shubhicodes Жыл бұрын
started learning GO great share Melkey
@choleralul Жыл бұрын
Love Go! let's goo Melkey!!
@MelkeyDev Жыл бұрын
WOOOHOOO!
@thingsiplay Жыл бұрын
I know you from Prime reacting to your meme videos. :D Just started learning Go after Rust and Python. Looked into Haskell and Zig first. Zig is still not at version 1.0 and Haskell is, well it's Haskell. So I go with Go for now. And the project layout was one of the first things I wondered. This and probably your other videos will help me for sure.
@MelkeyDev Жыл бұрын
Welcome aboard!
@emil_l889 Жыл бұрын
Greatest Go content on KZbin GLOBALLY
@MelkeyDev Жыл бұрын
Continuing this GO TRAIN
@AnatolyLeonov6 ай бұрын
Thanks for the descriptioN!
@MelkeyDev6 ай бұрын
Youre welcome
@emil_l889 Жыл бұрын
This video was so good I got promoted to cto instantly
@MelkeyDev Жыл бұрын
Auto billionaire
@Muhammed-nani964 Жыл бұрын
The go guy I started switching to go we need more tutorial and projects 😂
@MelkeyDev Жыл бұрын
OKAY! What do you want to see?
@Muhammed-nani964 Жыл бұрын
@@MelkeyDev my an entire crash course of web api creation with go MySQL (with auth too) Or a simple project 😁
@manankoyawala53379 ай бұрын
Hey bro give me tip how you change your terminal look can you make video because I like your terminal look which is very fancy
@kchak146 ай бұрын
Can you make a video on or share resources for Unit Testing in Go? Specifically, code coverage reports on a Windows machine.
@gugamar27 күн бұрын
I've been coding in go for a while now, and I haven't found a good way to structure complex projects. For example, the lack of sub-packages, means that go code is insanely flat. And that means there is no obvious path to try to decipher the relationship between the packages, and the relationship between the entities in the packages and across packages. So, I often find myself having to hold the entire code deciphered and in my mind simultaneously, and unless I do that, I don't feel confident that I understand anything at all. Even within a package folder, either there is one giant file, or a bunch of file that I don't know which one should be opened first. Do you have an example of a complex go project that you can point to as being really well structured?
@melkeydevvods7698 Жыл бұрын
GO IS AWESOME!! I hope you enjoy it. Make sure to like, comment for MORE GO CONTENT!
@thingsiplay Жыл бұрын
You are an imitator and fake of this channel??? Using same icon and name, but are not linked in the official channels list of channels.
@JoeNgera5 ай бұрын
Wow man. You just demistified a lot for me. Thank you
@MelkeyDev5 ай бұрын
AYe - thats awesome!
@IkraamDev Жыл бұрын
Keep up the Golang videos!
@pavelastraukh9905 Жыл бұрын
Thank you so much. For last few years I was programming in ruby using rails framework where layout is defined by framework and I was really struggling with figuring out what layout to use.
@pjc825 Жыл бұрын
Can you please create a video discussing Workspaces and there uses. Thanks for the great content 💯😃👍
@MelkeyDev Жыл бұрын
Yeah - for sure But what do you mean? Can you be more specific?
@pjc825 Жыл бұрын
@@MelkeyDev Just why would one use workspaces in the first place, do I actually need them or not, what is there general purpose of them, that sort of thing 👍
@MelkeyDev Жыл бұрын
@@pjc825 Workspaces (the Go workspaces) are used when you are potentially working in a Monolith, or a project structure that has multiple non-go sub dirs. For example, you can have your React code in the client folder, while your Go code is in another.
@rootdefault62637 ай бұрын
So this might be a very noob question. Am still a beginner in go coming from a Laravel world (YES I CODE IN PHP). where would you place your middle ware, database related files like configuration,queries and your HTML pages (of course with its assets). so far I have been trying to build a simple crud project and its working well but its terrible in terms of structure and maintenance for a serious project is a nightmare. your guide will be very much appropriated you earned my sub by the way Much love from TANZANIA
@benkogan15799 ай бұрын
I see a lot of projects put a test file right next to the source file / package it's testing, i.e. no tests directory. Not sure I have a strong opinion on one or the other.
@rohithgilla9492 Жыл бұрын
Thanks for making such awesome content, what’s your prefer way to deploy go apps, can we have a video on that if possible
@MelkeyDev Жыл бұрын
Coming soon!
@vormavius Жыл бұрын
I charge like 50% extra amount when I have to work on a project with this structure.
@normaneshuchi54749 күн бұрын
Just to clarify, we do test. In production. Tell my PM I said Hi
@AdeaduraAdegbite Жыл бұрын
whoa 10k subs already, way to go
@MelkeyDev Жыл бұрын
🎉
@ali-ozen10 ай бұрын
what is your guake theme?
@naresh_deeti6 ай бұрын
In Go, why functions name should be in PascalCase, why lib/dependency called package
@dan_le_brown6 ай бұрын
I have watched this video couple of times and "you guys don't write tests 😂" always get me rolling
@ahmeism90 Жыл бұрын
wow, happy see some nice educative golang content. i would love yo see some real world api project with best practices. Just like you would do for some clinet
@MelkeyDev Жыл бұрын
Many many thanks
@mddawid0323 Жыл бұрын
Great video, I have learnt a lot. One question, how to create multiple folders with mkdir command on windows powershell? The method you have used on linux does not work.
@MelkeyDev Жыл бұрын
I am not sure - I dont develop on Windows. I don't recommend it
@zevo92 Жыл бұрын
1. Nice video 2. I may be dumb, but the first link you put in the right top corner, just takes me to " more from Melkey", which I think you did not intended. I'll put my thinking cap on and find that video, but I wanted to say this maybe it's a bug?!
@MelkeyDev Жыл бұрын
Oh my. I am SO sorry. kzbin.info/www/bejne/hXTSpXyZZ6ablZI&t This is the video. Thank you for catching that!
@zevo92 Жыл бұрын
@@MelkeyDev I’m something of scientist, and I found it myself. View it, liked it. Thank you sir! Cheers!
@dentforpersonal8 ай бұрын
Great Video! I learned a lot. But why does all the module need to have the github prefix ?
@MelkeyDev8 ай бұрын
They dont! Just if you want to make them public its a common pattern to do it like that
@nyantaro1 Жыл бұрын
Love you melkey
@MelkeyDev Жыл бұрын
I love you too thank you
@Endurancecoach00 Жыл бұрын
Dope vid as always super helpful
@MelkeyDev Жыл бұрын
Appreciate it!
@muratasarslan235910 ай бұрын
Heyy Melkey, wonderful video. Very helpful. Would like to create a realistic REST api targeting prod making use of this structure with you 😺
@omarcrosby Жыл бұрын
Can you explain why you prefer to keep tests in a separate folder instead of next to the files they are intended to test? Just curious.
@chandup8 ай бұрын
I see an advantage (there might be better approaches too): - if you want to ignore tests while building final go application container image. This reduces your final code base you are delivering. But for easy human consumption when looking at code base, test folder should follow the same structure as main code base, so that it’s easy to relate the relationships between folders and test files to the main code base folders and code files. Maybe someone can add more insights here.
@sambacarlson4 ай бұрын
very useful. Thanks man
@mouhannadal-hmedi150111 ай бұрын
amazing! thanks
@MelkeyDev11 ай бұрын
No problem
@akileshkumarb77508 ай бұрын
2:57 felt personally attacked
@Cyber_Lanka Жыл бұрын
Hey what about the embed package? I don't think it's possible to embed static files outside of cmd directory or handlers.
@stevezhang386910 ай бұрын
it says adjust this project/package1/package2/package3 to project/package1, project/package2, project/package3
@GV14982 Жыл бұрын
Do you have any suggestions for handling a go monorepo?
@MelkeyDev Жыл бұрын
It is typically the same structure, just with more sub directories within the /internal
@vikingthedude Жыл бұрын
What if we create a cmd/main.go instead of nesting it within another folder?
@manfrombritain68169 ай бұрын
i can't actually explain why but i like Go. the syntax feels a bit ... i dunno it's sort of like moving from speaking to English to German... everything seems to be in a slightly different order. but i like it
@JammUtkarsh Жыл бұрын
The layout of opened file is like the one in focus mode. But you have ribbons in that too. I need that one. pls share or just make a video on your dev setup(i know it's pretty classic one but pls its needed.)
@stevezhang386910 ай бұрын
just disable vscode activity bar, or enter focus mode and key Ctrl + Shift + E
@medilies Жыл бұрын
The chase is cut at 3:52
@bpa57218 ай бұрын
Writing Go for a living. I am jelly.
@MelkeyDev8 ай бұрын
You can do it too!
@NoctuaDeveloppement Жыл бұрын
Amazing content ! Maybe it's a useless question but is it better to use Gin or Go the hard way to build a full Rest API ?
@MelkeyDev Жыл бұрын
i mean, you can definitely use Gin but I think using Go built in lib is nice!
@NoctuaDeveloppement Жыл бұрын
@@MelkeyDev Yeah it's definitely what I did, builtin lib and no ORM to learn the basics of the language 😃 Thank's for the answer 😀
@Cordic458 ай бұрын
nice job GOPATH vs go module really make me confused
@ehSamurai34836 ай бұрын
I have a question, like in JS/nodejs we have a folder thats specific to a project called "node_modules", don't we have something like it in golang?
@fliplucky8813 Жыл бұрын
Ey Melkey, great video I have been starting up golang for a basic backend with htmx. I am working on building a docker setup around it with a databse and eventually an extra node container for scss Could you perhaps show how you would make a docker setup ( perhaps even with live reload) ? Thnx! Keep on making these golang videos, i accpreciate them a lot!
@MelkeyDev Жыл бұрын
Air is really good I do recommend
@MelkeyDev Жыл бұрын
Sounds great! I will do that. Docker + Go + Air coming right up
@fliplucky8813 Жыл бұрын
@@MelkeyDev I have visited your twitch several times couple of years ago. Still love the introduction i got to Obsidian from you. But in all honesty, i like your way of presenting. If you can create a golang series, i will be sure to set the notifications. I like golang, but somehow the content either is: "build this demo/tutorial with me", or loose examples. Most articles on the web ( at least which i have found ) are the same. I am missing the coherence/practical concepts. For example this video. Short, practical, great reusability My request for the docker/golang/mysql is imo also something to benefit for whatever project a dev is going to make.
@AylaCroft Жыл бұрын
😅 I need to learn Go. I think Backend dev is adding Go to their courses.
@MelkeyDev Жыл бұрын
Go is the BEST
@mr.togrul--9383 Жыл бұрын
HTMX +SVELTE+GO booom make it happen
@vikingthedude Жыл бұрын
Do we gitignore the bin directory? Considering that the contains the output build, we wouldn’t wanna track that in version control right?
@pylotlight Жыл бұрын
The biggest annoyance for me has been maintaining go versions and updates. Theres no inbuilt go update latest. you have to know the latest version number and manually manage that, then manually manage env vars which is also gross, I shouldn't have to be touching that imo.
@popplestones8868 ай бұрын
Why the hate on nesting packages?
@teej_dv Жыл бұрын
this doesn't look like ocaml?
@MelkeyDev Жыл бұрын
This is CSS
@bradleyfrueh2761 Жыл бұрын
Is golang useful for data science? I know python has all the libraries but its slow. Could golang fill in the gaps of python?
@MelkeyDev Жыл бұрын
Great question. I personally dont think so. I think Python will be the data science language for a while. Or Julia
@JayJay-ki4mi Жыл бұрын
Recovering Rust developer here.
@kiryosity_ Жыл бұрын
Thank you for video! I have a question related to tests. How can I keep my tests in a separate folder if I want to test not exported (private) function within my package? Anyway, it would be nice to see how you'd recommend organise your tests :) Thanks!
@David-gj6dc10 ай бұрын
I don't know about separating folders but in principle you should not be invoking private functions. Unit testing should only interface with the public API and treat it's internal calls as a black box.
@lobokun Жыл бұрын
can i delete my test folder if i do not use it?
@konjikiyami7301 Жыл бұрын
Yes, there is no need to create directories your project does not need as Go doesn't have as strict of project structure compared to other languages. Of course, there are a few exceptions, but the case you described is not one such.
@everythinggoes850 Жыл бұрын
I agree with everything except the pkg directory. For me it creates an unnecessary indirection.
@MelkeyDev Жыл бұрын
I honestly agree with you. I have only used internal in my projects (the demo shows that) but the convention for a lot of people was to include pkg as well
@bumpy_lumps Жыл бұрын
All these kids talking about Pokemon Go need to Pokemon Go write some Go
@IanHamilton-hm9xm5 ай бұрын
No provided code repo?
@kubre Жыл бұрын
More go content
@GustavoDiaz93 Жыл бұрын
There is no a “best” way to structure your projects.
@2gbeh8 ай бұрын
THERE ABSOLUTELY IS
@pieterrossouw85968 ай бұрын
but there are many terrible ways to structure codebases. Gotta keep the WTFs/min low.
@kaioneal61606 ай бұрын
We have a new videos series idea . How to not structure your go projects
@tobi-bАй бұрын
There is but its project dependent.
@valentinrafael9201Ай бұрын
There absolutely is a best way, if you define “best” as “by convention, we’re going to structure the dirs and this way and name the files in this way”. AKA idiomatic.
@karimshakirov Жыл бұрын
Use Arch btw
@cbbcbb68036 ай бұрын
And if I do not use github ...?
@tanrosa Жыл бұрын
Maybe it is only down to the guys, because I am really keen on testing!! 10:53 #GirlsInTech #WeGotPower
@MisfitsFreshToDeath Жыл бұрын
Ackshually, on Linux theyr'e called directories not folders
@MelkeyDev Жыл бұрын
lmfao get out of here
@BrunoidGames7 ай бұрын
Go 1.22 have router wildcards \m/
@MelkeyDev7 ай бұрын
Oh HELL yes i didnt know this
@BrunoidGames7 ай бұрын
@@MelkeyDev I mean.. Go, not Docker.. xD
@LacksonMunthali Жыл бұрын
All you have to do is click the big blue button then booom!!! you are hoocked 😅
@Zmey5656Ай бұрын
I didn't recognize you with the mustache.
@markjameshender359210 ай бұрын
Recommended this channel and then I hear keep tests in a separate folder. Keep e2e and integration there only. Don't make people search that nest for unit tests..
@Learn_IT_with_Azizul Жыл бұрын
nice,,, but, plz proceed with more hands on.... then it would be better for the audience. Ty
@clouds_304 Жыл бұрын
Why is the one tag neovim 😂
@roberto_camp6 ай бұрын
so it's unconventional to have main.go at the actual root of the project?
@cariyaputta Жыл бұрын
This "standard" layout sucks, it's a convoluted mess. Ask yourself this question: Am I developing a library/tool or an application? For application development, there's no "standard" layout, start with the simplest flat project structure and go from there.
@krzysztofb7560 Жыл бұрын
👆
@RandomShowerThoughts Жыл бұрын
Personally I don’t like having a test directory, the tests should be near the source code with a _test name
@gearboxworks9 ай бұрын
Unit tests should be near the code, integration tests should be in their own directory.
@CodeWithRivandra6 ай бұрын
Man please zoom in 😂
@guhkunpatata3150 Жыл бұрын
"I know you do not create test" that's not me. i created the folder test then delete it after 5 seconds.
@musdevfrog Жыл бұрын
Thanks Mr. VS C*de user.
@navneetsingh519111 ай бұрын
Hey windows is pretty nice ok
@MelkeyDev11 ай бұрын
psch
@kodder Жыл бұрын
half asleep still, been trying to write something witty as comment...I got nothing. I failed myself.
@tarn_jihas Жыл бұрын
first hi
@OrangePingPongBallАй бұрын
"recovering rust developers" 🤣🤣🤣
@pocketmayo Жыл бұрын
Hi dad
@MelkeyDev Жыл бұрын
Hey son
@alcb1310 Жыл бұрын
Wait what, do you actually test??? Lol Ok in a serious note, you should make a video on go testing
@MelkeyDev Жыл бұрын
I will! Thank you
@user-fb2cb6xp7c11 ай бұрын
I almost killed myself while trying to arrange my golang project
@suphakinthiwongАй бұрын
You don't know me, my company and i always force to create tests every fk time.