STOP! This Is How You Structure Golang Applications

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ม.ค. 2025

ความคิดเห็น • 52

  • @anthonygg_
    @anthonygg_  ปีที่แล้ว +5

    ► Join my Discord community for free education 👉 discord.com/invite/bDy8t4b3Rz
    ► Become a Patreon for exclusive tutorials 👉 www.patreon.com/anthonygg_
    Thanks for watching

  • @EricFialkowski
    @EricFialkowski ปีที่แล้ว +37

    Too many developers forget that the goal is solving the problem, not playing around with all the "computer science-y" stuff. Don't get me wrong, that stuff is what got me into programming but it doesn't pay the mortgage or buy the margaritas. 🍹👍

    • @tehseensajjad1003
      @tehseensajjad1003 ปีที่แล้ว +2

      i dont remember who said it or where or how it was said but
      "Whats ultimately important is the value your program is going to provide to the user, not the tools you're building it with"

  • @vitiok78
    @vitiok78 ปีที่แล้ว +17

    If you want to write a huge monolith then by all means use Clean Architecture, good abstractions, and all that stuff.
    But... Go is the best when it comes to microservices. And you don't need to add that kind of complexity to a microservice. You'll only burn all your time. Microservices don't usually live long and you will eventually kill them or rewrite completely.
    So... Do not overengineer things. Make it simple, make it fast, make it readable.

    • @AlbertBalbastreMorte
      @AlbertBalbastreMorte ปีที่แล้ว

      YES! The crazy structures needed for code that's 1M lines long are usually overkill for microservices!

  • @su1cedek
    @su1cedek ปีที่แล้ว +17

    Thanks, very simple and straightforward. I think the "cmd" folder is only useful if your project has multiple executables, i.e. if you have multiple CLI tools, or a rest+grpc APIs

    • @pelic9608
      @pelic9608 ปีที่แล้ว

      Stopped using 'cmd' folder after company's cybersec approached me the third time for running unkmown .exe with 'cmd' in the path. 😄

  • @ElderSnake90
    @ElderSnake90 ปีที่แล้ว +10

    Finally a sane developer!

  • @vitiok78
    @vitiok78 ปีที่แล้ว +11

    I often put every API handler in its own file because it's an entry point and you often need some extra helper functions logically tied to this entry point only.
    But all the middleware that is common to multiple entry points I put in a single file. It is very convenient to find and change them later.

  • @Jack-z6j4q
    @Jack-z6j4q ปีที่แล้ว +5

    Imagine building a house.
    450 sqft, it's like a studio apartment. You don't need massive support beams, or reinforced foundation, etc. This would be like a minimal approach, no crazy deep nested folders, etc. Just solving the problem and done.
    Now imagine building a sky-scraper. You're going to need a hell of a lot more. This would be your gigantic enterprise application, with multiple go modules, folders & organization, documentation, etc etc. But you have to be aware of the scope of the problem, and fit that problem with the appropriate sized tactics.

    • @aqezzz
      @aqezzz 11 หลายเดือนก่อน

      Definitely agree. Lots of developers today see (and especially start with) small software problems to solve and forget that big software comes with its own set of problems that *do* have to be solved. No one made these patterns up for fun, they did it to get out of the hell that is a huge spaghetti code base that developers literally quit over. No, you don't need all the architectural patterns for hello world, but yes they do have a place when software grows to a certain size.

  • @thesaintseiya
    @thesaintseiya 11 หลายเดือนก่อน +1

    Great video, really helps me as someone new to Go! I however put my main package in a cmd/app folder simply because I don't want it laying around the 20 JavaScript/frontend config files lmao. Also love your style of humor

  • @CorleyPC
    @CorleyPC ปีที่แล้ว +6

    Good stuff!
    All projects should be born with a flat structure. If the need for restructuring arises, refactoring is cheap. Bearing with useless folders isn't.

  • @mm100latests5
    @mm100latests5 ปีที่แล้ว +3

    great edu vids, i've learned golang completely from scratch using your channel and patreon

  • @toroktechnology7420
    @toroktechnology7420 ปีที่แล้ว +10

    Don't get me wrong but this has many downsides
    - refactoring
    - scaling
    - solving deep business problems
    - this will not work for team has different members because updating and writing everything in the root file will result my merge conflicts

    • @anthonygg_
      @anthonygg_  ปีที่แล้ว

      Im the deviation. I decide

    • @austecon6818
      @austecon6818 ปีที่แล้ว +2

      Most software projects only have 2-3 developers anyway... many have a one dev per microservice policy.
      Any project that grows beyond 2-3 devs would already have scaled up to having most things separated out into directories a long time ago...

  • @ryanjoy0000
    @ryanjoy0000 ปีที่แล้ว +2

    Awesome ! Proud to be part of HVE family!

  • @kavereon
    @kavereon ปีที่แล้ว +1

    You're really knowledgeable and hilarious! 😂
    I'm glad I found your channel. Subscribed!

  • @EricWAtchesVideos
    @EricWAtchesVideos 10 หลายเดือนก่อน +1

    Will you please do a video on go-echarts? Specifically how to group and filter axes in bar or line charts.

  • @WaldirBorbaJunior
    @WaldirBorbaJunior ปีที่แล้ว +5

    Perfect. Just as I work.
    1st make it work and let the customer happy and put money into my pocket.
    2nd. refactor the code.
    Simple as that. #go4ever

  • @vitiok78
    @vitiok78 ปีที่แล้ว +8

    1. Just make it work.
    2. Throw it away.
    3. Write it better the second time using the info from step 1.
    4. Margaritas!!!

  • @austecon6818
    @austecon6818 ปีที่แล้ว +3

    100%. That's partly why I like python so much... when I moved to C# I was lost for words at the insane over-engineering!!!
    Python let's you scale up the project structure as it is called for.
    I'm sure you can do the same I'm C# but it's not what the culture encourages

  • @DUKENNSCHMILPs
    @DUKENNSCHMILPs ปีที่แล้ว +6

    With too many folders/packages also you can get the problem of cyclic depedencies.

  • @idearat0
    @idearat0 6 หลายเดือนก่อน

    "You are not programming... you are confused. You are not a programmer... you are a configurator." -- Anthony GG ... priceless.

  • @EnterCloud
    @EnterCloud ปีที่แล้ว +2

    The title definitely caught my attention

  • @hassananwar2431
    @hassananwar2431 ปีที่แล้ว +2

    I think I was forgeting main problem and was lost in my folder structuring...

    • @anthonygg_
      @anthonygg_  ปีที่แล้ว +2

      You are cured now.

  • @90hijacked
    @90hijacked ปีที่แล้ว

    Don't diss my attention span senpai!
    I've been watching these videos every day after work for a couple months now!
    -- sincerely, a lurker

  • @Nexjsdeveloper
    @Nexjsdeveloper ปีที่แล้ว +1

    This video is so usefull for me, also if u can, make a video for creating video streaming server by pure golang and not with help of "HLS" like your video for large stream files.

  • @aslkdjfzxcv9779
    @aslkdjfzxcv9779 ปีที่แล้ว +4

    second time the in the last couple days i've heard of "hexagonal" architecture. figured it's just DI.

    • @deNudge
      @deNudge ปีที่แล้ว +1

      Not exactly. It's more like onionskins. Inside you have the business logic, outside you have everything for I/O.

    • @aslkdjfzxcv9779
      @aslkdjfzxcv9779 ปีที่แล้ว

      @@deNudge thanks, i'll have to dig a little deeper

  • @suikast420
    @suikast420 11 หลายเดือนก่อน

    What about if you build a lib.
    At least the internal is very useful.
    Isn't it?

  • @Nexjsdeveloper
    @Nexjsdeveloper ปีที่แล้ว +2

    You r the best
    " honestly i don't know what is it"" 🤣🤣🤣🤣🤣

  • @charlesbcraig
    @charlesbcraig ปีที่แล้ว

    “You are not a programmer. You are confused” 😂

  • @guledomer
    @guledomer ปีที่แล้ว +1

    wonderful. Just do it, it doesnt matter

  • @GrahamAtDesk
    @GrahamAtDesk ปีที่แล้ว +1

    Very pragmatic 👍

  • @Flascoo
    @Flascoo ปีที่แล้ว +2

    support comment for youtube algos sheeesh

  • @adanpalma4026
    @adanpalma4026 4 หลายเดือนก่อน

    Any time that you spend designing a more manteinable software and don’t respeat your self is priceless. Is not overthhink is arxhitecture.
    Any can write Lines of code and solve problems but build more manteinable software umm no sure

  • @dr3w979
    @dr3w979 ปีที่แล้ว +2

    Thanks for this

  • @tgaming2518
    @tgaming2518 ปีที่แล้ว

    Amazing videos! Thank you so much

  • @nodidog
    @nodidog ปีที่แล้ว +1

    Your comment about ports being equal to skill level 😂

    • @anthonygg_
      @anthonygg_  ปีที่แล้ว

      No more 1337 or 3000 from now on.

  • @cipcip4986
    @cipcip4986 ปีที่แล้ว

    another beer 🍻

  • @goocarry_yt
    @goocarry_yt ปีที่แล้ว +2

    👍🏻👍🏻👍🏻

  • @TheSupahG
    @TheSupahG ปีที่แล้ว +1

    sheeesh, so many mouse clicks, probably the most from all your videos

    • @anthonygg_
      @anthonygg_  ปีที่แล้ว +1

      Lmao true that.

    • @su1cedek
      @su1cedek ปีที่แล้ว

      I feel pain every time he writes ACcount

  • @bodunjo
    @bodunjo ปีที่แล้ว +1

    I start this shit on stream))