Golang Package Structure Explained in 7 Minutes

  Рет қаралды 35,629

Golang Dojo

Golang Dojo

Күн бұрын

Golang Package Structure Explained
In today's Golang video, we will talk about the Package Structure in Go. We will go through the types of packages, package naming, package scope, how to structure packages, and everything you need to know about Package Structure in Go programming language. Enjoy!
--
Golang Dojo is all about becoming Golang Ninjas together. You can expect all kinds of Golang tutorials, news, tips & tricks, and my daily struggles as a Golang developer. Make sure to subscribe if you look forward to such content!
Get Your Golang Cheat Sheet! - golangdojo.com/cheatsheet
Git repos & notes - golangdojo.com/resources
Golang Project Structure - • Playlist
--
#golang #goprogramming #golangdojo

Пікірлер: 60
@GolangDojo
@GolangDojo 2 жыл бұрын
📝Get your *FREE Golang Cheat Sheet* - golangdojo.com/cheatsheet
@itsabzer8431
@itsabzer8431 Жыл бұрын
cheat sheet doest get sent when input my name and email. is the link no longer working? I've tried 3 of my emails
@ericzorn3735
@ericzorn3735 2 жыл бұрын
I would love to see domain driven design architecture. I really have been a fan of CQRS with event sourcing and would love to see the implementation in go
@HAL-9000-
@HAL-9000- 2 жыл бұрын
☝️
@GolangDojo
@GolangDojo 2 жыл бұрын
Thank you for the suggestion!
@rafabil1096
@rafabil1096 2 жыл бұрын
☝️
@frankfix247
@frankfix247 2 жыл бұрын
Just to mention... 1. Packages/directories should not use plural naming. 2. Executable(s) should mainly be placed in the cmd/ directory.
@vitorrocha9225
@vitorrocha9225 2 жыл бұрын
Bro, you are building a great community, keep goin on. There's so many videos to do
@churraskindequeijo8418
@churraskindequeijo8418 2 жыл бұрын
I would love to see more content on project structure, this video helped me alot, I was doing a ton of shit wrong lol thx
@dancollings
@dancollings 2 жыл бұрын
More designs please 🙏. Keep up the great work. Great content.
@mystiqkc
@mystiqkc Жыл бұрын
Excellent video! Thanks for these.
@nickolas1386
@nickolas1386 2 жыл бұрын
I’d like to see how you’d recommend organizing a larger MVC design with database. This video was great!
@padawanpath
@padawanpath 11 ай бұрын
great video mate, really clear and to the point
@alunoazul
@alunoazul 2 жыл бұрын
I would... REALLY REALLY REALLY like to see a video about more complex project structures. Please! Please!
@slimbron9489
@slimbron9489 Жыл бұрын
Excellent content ⭐, thanks for sharing 👍, it would be nice to see more content on architecture of complex projects in golang.
@farzadmf
@farzadmf 2 жыл бұрын
Oh no! Don't remove your Ninja intro, I LOVED It 🙁
@GolangDojo
@GolangDojo 2 жыл бұрын
Coming right back :)
@farzadmf
@farzadmf 2 жыл бұрын
Great! 😆
@gideonfelt2819
@gideonfelt2819 2 жыл бұрын
I'd love some videos on common design patterns!
@GolangDojo
@GolangDojo 2 жыл бұрын
Coming soon!
@ant1fact
@ant1fact Жыл бұрын
Thank you for this, Dolan Gojo
@alekseytrump1586
@alekseytrump1586 2 жыл бұрын
Thanks. Go next video, on design and hard architecture application :-)
@SirMo
@SirMo 10 ай бұрын
This tutorial is missing the biggest question I had. And that was the recommended way to import these packages. Oh well.
@flexairz
@flexairz 2 жыл бұрын
I would like to see more of the complex project structures in Go. BTW: the new video format is less personal.. I liked the old format better..
@GolangDojo
@GolangDojo 2 жыл бұрын
Thank you for the suggestion!
@carlosdelgado5632
@carlosdelgado5632 2 жыл бұрын
If you could go through each one with examples it would be awesome 👏
@GolangDojo
@GolangDojo 2 жыл бұрын
In the pipeline
@hoxorious
@hoxorious 2 жыл бұрын
Great video as always. 6:21 yes of course we want! 🤩
@GolangDojo
@GolangDojo 2 жыл бұрын
You got it!
@BrunoDrugowick
@BrunoDrugowick Жыл бұрын
Your videos are good, keep it up! :) I'd do a bit different, tbh: packages under pkg, with the structure you suggested probably, and main(s) under cmd.
@mouhannadal-hmedi1501
@mouhannadal-hmedi1501 Жыл бұрын
amazing!!! thanks
@krige
@krige 7 ай бұрын
5:00 You are structuring your packages by type. Package-by-type only works on small-scale projects. Package-by-feature is superior in the majority of cases as it allows to play with the components' scope. We can use the access modifiers to enforce Law of Demeter and the dependency inversion for integrations or/and extensions. Other reasons are: easier code navigation, a higher level of abstraction, minimize scopes (bounding contexts), vertical modularization.
@Rundik
@Rundik Жыл бұрын
Packages should be small and many, but you shouldn't use camel case. That's like impossible, you can't get many of short names also being descriptive
@a4e69636b
@a4e69636b Жыл бұрын
Thank you for this video. I would like to see a MVC video please.
@sarthaktiwari8515
@sarthaktiwari8515 2 жыл бұрын
great video, nicely explained :D
@GolangDojo
@GolangDojo 2 жыл бұрын
Glad you liked it :)
@angelkarki2963
@angelkarki2963 Жыл бұрын
have you made anything about MVC package structure brother?
@amitsharma928
@amitsharma928 2 жыл бұрын
Nicely explained 👍 Thanks
@GolangDojo
@GolangDojo 2 жыл бұрын
Welcome!
@regexPattern
@regexPattern 2 жыл бұрын
Btw, a vim tip for when you were talking about block scopes: you can select all the inner elements of the current scope with vi{
@GolangDojo
@GolangDojo 2 жыл бұрын
I'm still a noob in vim :)
@RootsterAnon
@RootsterAnon Жыл бұрын
@@GolangDojo @ThePrimeagean will help you. Watch his vim 6 part tutorial. It's everything I ever wanted.
@kaushik5055
@kaushik5055 2 жыл бұрын
👍
@manuelcarbajal7610
@manuelcarbajal7610 2 жыл бұрын
Please! Let's dive into those other topics! :D This part of Go is one I find a little confusing :P
@GolangDojo
@GolangDojo 2 жыл бұрын
In the pipeline!
@sasipraveen5257
@sasipraveen5257 2 жыл бұрын
Finally Vim
@GolangDojo
@GolangDojo 2 жыл бұрын
;)
@budi0580
@budi0580 2 жыл бұрын
DDD project structure pls..
@user-hd8tg4em2n
@user-hd8tg4em2n 2 жыл бұрын
Nice introduction, but what if we had a complex situation where a package relies on another package but also the package it calls from? for eg. We have Server, Client and Routine packages, in client we have a client struct, and in routines we want to run a routine with that client type from client package as a parameter, how does this work? If we try import client into routines, we get a import cycle. client relies on routines to run the routine and routines relies on client to access the type. You could put the client struct into it's own package and import that where you need it, but what if client has functions tied to it? This won't work because it's not a local type of the client package so we can't add functions to the client struct instantiation.
@GolangDojo
@GolangDojo 2 жыл бұрын
Circular reference doesn't work here as I briefly mentioned. The actual organization depends the specifics, but perhaps you'd need to duplicate the routines for the client, or utilize interfaces to make the routine or the client more generic. Also, I'm not entirely sure what the routine you refer to is about.
@user-hd8tg4em2n
@user-hd8tg4em2n 2 жыл бұрын
@@GolangDojo I've been doing a lot of reading and it seems interfaces are a way to achieve this along with a separate package just for types, but now I run into issues of the type that's local to client not being the type in routines that we import from the types package.
@mahendranath2504
@mahendranath2504 6 ай бұрын
DDD, please 🙏
@mr.k8660
@mr.k8660 15 күн бұрын
You didn't show code 🙄
@sydpao2224
@sydpao2224 2 жыл бұрын
Goland vs IntelliJ (go plugin) vs vscode
@TJ-wc3iq
@TJ-wc3iq 2 жыл бұрын
No-no! Please follow "Package Driven Development" instead of anything from Java, C# or even Node ecosystem. Pleeeeease 😋Keep Go clean, simple, and concise.
@samuelchinonsoarchibong1477
@samuelchinonsoarchibong1477 Жыл бұрын
You skipped the important part of executing the packages
@motdde
@motdde 2 жыл бұрын
Like a noob 👀
@matrixnorm6672
@matrixnorm6672 Жыл бұрын
narrator is drunk
@OddBallTrails
@OddBallTrails 3 ай бұрын
😂😂😂
Go Modules Explained in 5 Minutes
5:24
Golang Dojo
Рет қаралды 31 М.
Golang Packages & Scope Explained!
14:23
Golang Dojo
Рет қаралды 23 М.
50 YouTubers Fight For $1,000,000
41:27
MrBeast
Рет қаралды 171 МЛН
Дарю Самокат Скейтеру !
00:42
Vlad Samokatchik
Рет қаралды 8 МЛН
Does size matter? BEACH EDITION
00:32
Mini Katana
Рет қаралды 20 МЛН
This Is The BEST Way To Structure Your GO Projects
11:08
Melkey
Рет қаралды 67 М.
What can you build in Golang?!
11:10
Golang Dojo
Рет қаралды 163 М.
Why are Companies Migrating from Java to Go?
12:05
Golang Dojo
Рет қаралды 36 М.
GopherCon 2018: Kat Zien -  How Do You Structure Your Go Apps
46:18
Gopher Academy
Рет қаралды 112 М.
How to Start a Golang Project Right
32:44
rwxrob
Рет қаралды 40 М.
Every Programming Language Ever Explained in 15 Minutes
15:29
Flash Bytes
Рет қаралды 292 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 774 М.
Как бесплатно замутить iphone 15 pro max
0:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 551 М.
Самые крутые школьные гаджеты
0:49