DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for Why am I learning Go?
raddevus
raddevus

Posted on • Updated on

Why am I learning Go?

#go

Note

After writing this article people commented about Go being a terrible language. That's fine, I'm just learning Go for fun. But I wrote this other article about the popularity of Go. Check it out and comment.

Original Article

I started reading this book, The Go Programming Language, The (Addison-Wesley Professional Computing Series) 1st Edition (Donovan & Kernighan), on a whim, just to see what Go was all about and now I'm discovering how nice the language is.

Interestingly, this book will remind you of the old book K&R C (and Brian Kernighan is one of the authors).

Here are a couple of interesting things that Go does:
1) makes it very easy to build to a native Exe --
a) on Linux you can just do
Hide Copy Code

$ go build hello.go

That will build the native exe named hello and it even handles making the file executable (no need to run chmod 777)
b) There's not a huge toolchain to learn. Just use the Go command. it's kind of nice.
2) Go is "smaller" and so it feels like the days of past when you could actually wrap your head around a language instead of feeling like you could never learn it all.
3) It makes retrieving data over HTTP much easier than other languages -- more like just opening a file.
4) It cleans up concurrency issues / makes them easier to handle

Learning A Language That Keeps You Focused

It feels like learning a language that keeps you focused. Sometimes stuff is so huge now that you are going in a million directions with various tech like CSS, HTML, JavaScript, Angular, TypeScript.

Go & Rust Seems Similar

Now, I'm just interested in why I might choose Go over something like Rust (or vice-versa).

Have You Tried Go?

Have you tried out Go? What have your experiences with it been?

Top comments (10)

Collapse
 
rsa profile image
Ranieri Althoff • Edited on

Go is terrible, it lacks the most basic features that all other languages have. It has no error handling (and this makes cyclomatic complexity go sky-high), no generics (code generators are trash), even the math library has nothing to work with ints, only floats, no destructuring assignment for slices or structs, no real constants (const marks a compile-time value). Everything you do is reinventing the wheel, because the standard library is trash, it lacks everything.

The tooling is also terrible, you can't ignore parts of your code when checking coverage, the package system is awkward and contrary to about EVERY. SINGLE. EXISTING. SOFTWARE. they refuse to use --help flag to read help about commands for no particular reason. Worst of all, gophers would take these critics and just say Go is better this way.

I wouldn't waste time with such a mess. Pick Rust if you already know it, or even C++ is miles ahead even being decades older. There's no compelling reason to choose Go over anything else.

Collapse
 
raddevus profile image
raddevus Author

Very interesting. I was learning it as a backup to C++ and as an interesting investigation of β€œnew” languages. Thanks for chiming in. I will also look at Rust soon.

Collapse
 
mcsee profile image
Maxi Contieri

Go is a big mistake.

It has all the problems of a 60s language disguised as modern and efficient.
It lacks exceptions, closures and has dangerous references.
It pollutes your code with ifs and nulls.

It is fancy, trendy and performant. But I would never use it for a serious software design.

Collapse
 
raddevus profile image
raddevus Author

Very interesting. Has Go use faded at Google also? The initial thing I liked is that some things are made easier (concurrency) and it is a very quick language to learn (with my C/C++ background) and the small toolchain (no need to learn packager, linker, etc. it's all together.

Thanks for commenting.

I don't think I would use it for large things either but maybe for some small command-line tools (I run Ubuntu 20.04).

Collapse
 
mcsee profile image
Maxi Contieri

I think it is a very good language for scripting. Not for software development.

Thread Thread
 
raddevus profile image
raddevus Author

Agree 100%

Collapse
 
marcelcoding profile image
Marcel • Edited on

I also like go but I hate it because of the error handling. I would preferred exceptions like in Java.

Collapse
 
raddevus profile image
raddevus Author

I haven’t examined the error handling close enough yet. I think they were trying to make the language β€œlighter” by excluding exceptions but I’m not sure. Thanks for input.

Collapse
 
willdoescode profile image
Will

I like go because the syntax is not hard to learn, the compiler is really fast, it has a pretty good library management system, you can build for other os by doing GOOS=windows go build

Collapse
 
raddevus profile image
raddevus Author

I agree with all your comments. It is a very nice language and makes some dev tasks very easy and amazing cross platform abilities.

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.