The One BIG Reason to Learn Google's Go Language

preview_player
Показать описание
A goroutines are lightweight threads managed by the Go runtime. They are easy to use, and make Go brilliant for concurrency. Goroutines , in my humble opinion, are the top reason why you should learn Go. Here is a quick tutorial about goroutines and how to use them with another Go feature called channels.

---

#garyexplains
Рекомендации по теме
Комментарии
Автор

I've been learning a bit of Go. I'm a Sysops/Devops engineer and I find it much more manageable than Python.

drgrnUK
Автор

what I love about Go is the limited keywords and syntax, and there is not many ways you can write a program, which makes writing code and reviewing much easier

TrishanthDiwate
Автор

Nice and clear explanation as always. I was interested in Go language for long time and peeked at it couple of times, but never went too deep into it. Now you gave me a reason to explore it more.

pmkansara
Автор

Word of warning - as someone who implemented a good chunk of the Diablo 2 engine in go (10.2k stars on github, now archived), I'd make sure you read all up on "CGO performance". Go is a wonderful little language that I'd happily use for microservices or small console apps. But I'd _strongly_ recommend not even trying to use library bindings for any thing that requires decent performance. It's insanely slow and the 'workarounds' basically revolve around writing half your code in C, defeating most of the reason for not using C in the first place. I really hope they solve the CGO issue as it is a huge roadblock from it becoming anything more than a niche language. To reiterate, I love the language itself and its syntax, it's just a shame it has such a large 'gotcha'.

LunaticEdit
Автор

You know, I've been writing Go a lot and a little since it was released, and... I still can't put my finger on what exactly I like and dislike about it. I know I love its standard library; it's a stunning improvement over most languages I use, especially on the web. On the other hand, its general verbosity and extremely explicit error handling sometimes get on my nerves. The generics implementation seems like a giant nothing-burger for most use applications, which has been a little frustrating at times. Overall though I can't deny that it's a great language, and the oddities are minor and certainly possible to live with.

As for goroutines, I think I agree. It beats the hell out of most languages I've used with concurrency. However, I do find it far easier to optimize concurrent processes in Rust. To Go's credit, this is almost always passable and often even great right out of the box. In Rust, it's only good if you use good crates. If performance optimization matters though, I'll usually take Rust over Go. I think this comes down to memory management being more readily tuned in Rust, so this detail is only applicable if that's ever something you actually need to do. If not, Go is a clear winner.

Also, this video's description lead to me to seeing your video on dual core programming with the RP2040, which I hadn't really considered yet but I'm much more excited about now. Both great videos, thanks!

steve-adams
Автор

For the same reason, everyone must learn Occam and Erlang, just to get a feeling of what concurrency and parallelism really are. Coroutines are an important concept to know, but not the only one.

vitalyl
Автор

Let me just note that Golang is far from being the only language with built in language-level parallelism, "green" threads (that is, those managed by the language runtime rather than the underlying OS) or other forms of concurrency. However, it may easily be the simplest and easiest to adapt to for people coming from C/C++ or Java world.

bazoo
Автор

I spent a weekend drilling into processing, multiprocessing and asyncio just to finally get it cemented in my head. Your videos helped tremendously, thank you!

paxdriver
Автор

Yep — that is badass. I love abstractions such as this and even Python doesn't have its interface for that so clean (not to mention GIL). Very cool feature.

Gosu
Автор

I've read the documentation and watched some other videos, none was enough for me to understand channels, thank you for this video, very clear and easy to understand thanks to the great examples!

cjmarquez
Автор

GoLang is what got me into C. If you like Go, but you hate the garbage collector, C is for you.

KANJICODER
Автор

Most languages have some support for green threads. The unique feature about Go is it's duck interface implementation from outside a type. That I would say is much more defining of the language.

Verrisin
Автор

I have to say that my first experience with Go was rather pleasant. It's a straight forward language, with a build system and simple unit testing out of the box, nice enough concurrency mechanisms, good integration with IDEs and so on. Very fast to get going. However, as projects and complexity grows the poor encapsulation, lack of basic data structures, containers and algorithms and so on becomes a real problem. The recent addition of generics goes someway but it's not great, yet. At this point I want to like it but I'm not sure I do.

svensvensson
Автор

There are many languages that do that stuff as easy as go. Erlang, Elixir, Julia etc. Corouitines, channels are commodity nowadays. If you want thousands of lightweight threads look erlang. Go only brings table static compilation and less dependecy.

nathanruben
Автор

Rust is simply the best in terms of breaking the mold and solving memory safety in a robust way. Makes complete sense coming from "functional" java and the pain of C++

rob-
Автор

Been trying to learn computer programming and using Go as my first language. Probably not everyone's first choice but from what I have read and the small amount I have done it does make some sense to me so sticking with it.
This video was great to get my head round go routines.
Would be great to have more videos about Go!

TomMcGuire
Автор

There's a reason multi threading is more complicated in other languages, and it's not because they wanted to make it difficult.

JamesSmith-cmsg
Автор

such a nice and clear cut example of go routines. Thanks Gary!

adityamore
Автор

*GARY!!!*
Good morning Professor!!!

Good morning fellow classmates!!!

Stay safe out there everyone!!!

MarkKeller
Автор

Golang is a fantastic language. Goroutines and concurrency are so easy once you are using Golang

RandomShowerThoughts