Important Tips On How To Write Idiomatic Code In Golang

  Рет қаралды 23,649

Anthony GG

Anthony GG

Күн бұрын

Пікірлер: 68
@anthonygg_
@anthonygg_ 2 жыл бұрын
► Join my Discord community for free education 👉 discord.com/invite/bDy8t4b3Rz ► Become a Patreon for exclusive tutorials👉 www.patreon.com/anthonygg_ ► Buy me a coffee 👉 donate.stripe.com/aEU2a6ayH2uCa3u4gg Intro needs to be: "things YOU need to know" instead of I need to know :P :P Thanks for watching
@kenrod6643
@kenrod6643 2 жыл бұрын
I appreciate that you increased the text size! I also like that you had a summary of topics that you covered in the 2nd window for reference. Excellent information, thanks.
@lokthar6314
@lokthar6314 2 жыл бұрын
One of, if not the, best channels about go and software dev out there. Thanks so much for your work!
@anthonygg_
@anthonygg_ 2 жыл бұрын
Thank you
@indrajitdas8151
@indrajitdas8151 Жыл бұрын
what are such other channels about go?
@timi8272
@timi8272 Жыл бұрын
This video deserves more likes if you ask me, very invaluable tips! Thanks Anthony!
@espolete
@espolete 2 жыл бұрын
Great video! This content is pure gold for both newcomers and also some experienced devs that forget what idiomatic Go really means 😀. Thanks and keep it up!
@anthonygg_
@anthonygg_ 2 жыл бұрын
Thanks!
@thefrazz
@thefrazz 11 ай бұрын
Awesome! Writing idiomatic code instead of idiotic code!
@WomboBraker
@WomboBraker Күн бұрын
this is immensely helpful. holy heck
@nsgirish
@nsgirish Жыл бұрын
Excellent and very valuable points. Thanks sir
@dongueW
@dongueW Жыл бұрын
This was a phenomenal video, keep up the great work, looking forward to joining the patreon
@issm6685
@issm6685 Жыл бұрын
This very good. Please add more like this. And best practices. My favorite is the embedded interface.
@foreveryoung6108
@foreveryoung6108 2 жыл бұрын
Thanks KZbin recommendations that showed this awesome channel. I extremely like your content about Golang. Wait for every video, big fan
@ralphlorenzo9473
@ralphlorenzo9473 Жыл бұрын
I love your sense of humor 😂
@tpotjj2979
@tpotjj2979 2 жыл бұрын
Lot of value again in this video, keep them going!
@Patrickdaawsome
@Patrickdaawsome Жыл бұрын
"I'm sorry rubyists" hahaa I'm dead. As a Rubyist very reluctantly working in Go, this hit too deep.
@bjugdbjk
@bjugdbjk Жыл бұрын
This is so much useful brother, will really help to write the right code from the day 1 ....Amazing u r !!
@anthonygg_
@anthonygg_ Жыл бұрын
Thank you!
@metaltyphoon
@metaltyphoon Жыл бұрын
Love your videos. One of the most "stupid" things I've seen in a language was the convention of "Er" for interface. The C# version of just adding `I` in front is much simpler. `IStorage` instead of Storer. The "Er" simpler doesn't always work for some words.
@anthonygg_
@anthonygg_ Жыл бұрын
100% agree.
@Martin-mt6yo
@Martin-mt6yo Жыл бұрын
Or, the name could mirror what functionality the interface covers. In the example of the "Storer", it is possibly an abstraction over some persistence-layer, hence it could be Persister. I've used that approach a couple of times. The IStorage is for me more of a way around specifying what the purpose is, and instead naming the interface what you'd want the implementation to do, and not the other way 'round as it's, in my opinion, supposed to be.
@WaldirBorbaJunior
@WaldirBorbaJunior 2 жыл бұрын
Interesting, Must it is new for me. Thank you for sharing your Knowledge.
@jondoe79
@jondoe79 2 жыл бұрын
Keep them coming, the best go tutor 👍
@bersace
@bersace Жыл бұрын
You're awesome. Thanks.
@adjustyourtone
@adjustyourtone Жыл бұрын
Ahh the whole Suit thing - we call it a "type Prefix" in our Org - agree its important!
@efraimdeluxe
@efraimdeluxe Жыл бұрын
ok bro, you convinced me - i have subscribed!
@emzx111
@emzx111 Жыл бұрын
Thank you Anthony, these are really good tips. I really enjoy your videos, they are always simple, on point and explained thoroughly. Appreciate the effort and thought put into it.
@joofville
@joofville 8 ай бұрын
Awesome stuff thanks man. Agree with all these points. However, I don’t get the minimalist variable naming. I’m of the of the opinion that variable names should be as descriptive as possible
@marcosissler
@marcosissler 9 ай бұрын
Tks for the tips. Are really good ones, important and helpful. Ow, and simple. Like Go. 🎉
@vaishnavdeore2980
@vaishnavdeore2980 7 ай бұрын
"I'm so sorry Rubiest" I got there and laugh :p
@tnvmadhav2442
@tnvmadhav2442 2 жыл бұрын
Love it!!
@АлександрЗверев-й1х
@АлександрЗверев-й1х 2 жыл бұрын
Thanks a lot!
@nojerome497
@nojerome497 Жыл бұрын
Sorry but I'm not going to use small variable names to conform to your norm. They are going to be as long as i feel necessary to make it VERY clear what the variable is used for. But thanks for the rest of the tip, good content.
@larrasket
@larrasket 2 жыл бұрын
I fcking love your videos man
@JohnDoe-ji1zv
@JohnDoe-ji1zv Жыл бұрын
Just curious about last part of the video - constructor. If you define one New method per package, then how you suggest to structure your models/entities? Each entity per package with its own method or all entities in one package ?
@mouthearnose
@mouthearnose Жыл бұрын
Can I please know which VS code theme are you using? :) Btw great video!
@tucura9813
@tucura9813 Жыл бұрын
Hello, very nice video! I would love to hear how idiomatic comments are written. Are points appended to the end? In which tense are the written? e.g something like // writing to port // write to port Comments start with the name of the variable but whats the best form to write one e.g. for variable Amount in a struct bank // Amount is the amount of money is in the bank // Amount holds the money // Amount contains information about how much money is in the bank I'm pretty confused how to write clean comments. Same applies to errors errrors.New("failed to write to pipe") errors.new("writing pipe failed") errors.New("write pipe") Thank you very much:) Take care
@anthonygg_
@anthonygg_ Жыл бұрын
I think if the comment make sense for you its all good.
@bartoszgoebiowski1538
@bartoszgoebiowski1538 4 ай бұрын
the "handle" naming convention is new to me. Do you have any articles about it? i do not feel it for 100% Thanks in advance!
@leighlawley
@leighlawley Жыл бұрын
This guy codes like he's playing Starcraft
@anthonygg_
@anthonygg_ Жыл бұрын
Zerg player btw. 10 pool rush and call it a day
@sweetphilly2
@sweetphilly2 Жыл бұрын
In regards to grouping, I still struggle on whether I should group my variables. I generally follow the rule of declaring variables right before they're used. That way others can readily see the variable near its point of use. I think I learned that from Clean Code or Pragmmatic Programmer. If not, then probably some Medium post. Either way, I do that for all languages I use.
@M0du5Pwn3n5
@M0du5Pwn3n5 11 ай бұрын
That is the most questionable part of this video. There are many styles of variable grouping (and function grouping). The rest of this is pretty uncontroversial idiomatic Go. But the stuff about function and variable grouping is just this one guy's preferred style.
@CawaKharkov
@CawaKharkov Жыл бұрын
Hey, I really can't find any example or reference about "Must"+ panic
@Nexjsdeveloper
@Nexjsdeveloper Жыл бұрын
Tnx.
@_q1b_
@_q1b_ 2 жыл бұрын
Thanks you 💘
@pukito9123
@pukito9123 Жыл бұрын
awesome
@tigranrostomyan9231
@tigranrostomyan9231 Жыл бұрын
You are so cool!
@6365bharath
@6365bharath Жыл бұрын
Pretty useful to know these but very subjective imo. I highly disagree with the single character naming conventions. To each their own
@anthonygg_
@anthonygg_ Жыл бұрын
I can understand that.
@eastquack3342
@eastquack3342 Жыл бұрын
what hits home hard are the comments on what is going on; 7 times out of 10 he's quoting the golang docs verbatim; huge deal; also the remaining 3 are probably experience talking; wow
@hebozhe
@hebozhe 4 ай бұрын
Name your return values, especially if you're returning multiple things.
@dmitrygavrovsky5938
@dmitrygavrovsky5938 2 жыл бұрын
Could you please explain why are you using vscode but not neovim ?
@anthonygg_
@anthonygg_ 2 жыл бұрын
At the end of the day, neovim can do exactly what vscode does. But making neovim look like vscode is just a hassle with all the plugins you need. You will notice that after a period of time, things will break and you will need to spend too much time fixing those issues. Both are good editing tools, it's just what you prefer the most. Also, for streaming and recording, I think vscode scales a bit nicer in font and UI size for the viewer to watch.
@dmitrygavrovsky5938
@dmitrygavrovsky5938 2 жыл бұрын
@@anthonygg_ I cannot disagree with you, thank you for the reply. But my neovim loving friend pushing me too hard to be a "man" give off ms created "toys" and become a real man and use neovim :) Thank you again, it's real fun to watch your videos, but more how do you use tools to write a code and comment at the same time :)
@anthonygg_
@anthonygg_ 2 жыл бұрын
@@dmitrygavrovsky5938 Pretty sure your friend is not as fast as me in coding with his "nvim" setup. And by the end of the day, the only thing that matters is that you solved the problem you are facing. I once was just like your friend. But I turned into a man lately 😆
@miyuonline
@miyuonline Жыл бұрын
20:00
@pgtrots
@pgtrots 6 ай бұрын
Jfc that "enum" is pure trash. Sort it out, go.
@thisisreallyme3130
@thisisreallyme3130 Ай бұрын
Also trash: the “fat girl” jokes. Some of us work with (and appreciate) women who code.
@flflflflflfl
@flflflflflfl 2 жыл бұрын
Great video, thanks! Your pronunciation of idiomatic is not very idiomatic, though ;)
@anthonygg_
@anthonygg_ 2 жыл бұрын
You have no idea how many language errors I made in that video. Not my best day. 😥
@flflflflflfl
@flflflflflfl 2 жыл бұрын
@@anthonygg_ Don't worry, everyone knows it's not your first language
@cavila0217
@cavila0217 Жыл бұрын
@@anthonygg_ thanks for sharing your experience with us. Bro, Where are you from? Greetings from Colombia!
@DM-pg4iv
@DM-pg4iv 9 ай бұрын
Its a good list but at sole point your being nit picky. Like putting mutex above the thing you want to use it for. Just have descriptive variable names.
@electronicXtacy
@electronicXtacy 8 ай бұрын
Wow, the interface "tip" is such a bad example of cargo cult programming. Effective go only says this kind of derived naming is common for interfaces having only one or two methods.
@shanerigsby9030
@shanerigsby9030 6 ай бұрын
The information is great. For the presentation, I am irrationally irritated by the spastic cursor. I don't think it's just typing mistakes, though I do think you'd be well served to slow down your typing 20% and make no errors. I think the editor is doing some sort of intellisense checking, which makes the cursor hop around. If NOT, for god's sake stop doing that, yourself. This is driving me crazy and distracting from the otherwise high quality content.
How To Build A Chat And Data Feed With WebSockets In Golang?
20:45
How To Use The Context Package In Golang?
17:03
Anthony GG
Рет қаралды 66 М.
When u fight over the armrest
00:41
Adam W
Рет қаралды 30 МЛН
Каха и лужа  #непосредственнокаха
00:15
БУ, ИСПУГАЛСЯ?? #shorts
00:22
Паша Осадчий
Рет қаралды 2,8 МЛН
Mastering Inheritance By Struct Embedding In Golang
13:05
Anthony GG
Рет қаралды 31 М.
Say Goodbye to Magic Numbers: Using "Enums" in Golang!
16:04
Flo Woelki
Рет қаралды 6 М.
The Most Efficient Struct Configuration Pattern For Golang
11:10
How to speed up writing tests in Golang
22:01
Krishna Iyer HQ
Рет қаралды 60
Level Up Your Golang: 5 Concepts You Need to know
19:22
Flo Woelki
Рет қаралды 12 М.
Compilers, How They Work, And Writing Them From Scratch
23:53
Adam McDaniel (kiwi)
Рет қаралды 220 М.
How To Refactor A Golang Project By Using Interfaces
18:39
Anthony GG
Рет қаралды 14 М.
This Will Make Everyone Understand Golang Interfaces
21:03
Anthony GG
Рет қаралды 55 М.
My 10 “Clean” Code Principles (Start These Now)
15:12
Conner Ardman
Рет қаралды 280 М.
I regret doing this...
1:20:07
Tsoding Daily
Рет қаралды 85 М.
When u fight over the armrest
00:41
Adam W
Рет қаралды 30 МЛН