Part of a new series! Feel welcome to dip in and weigh in on a past question.
Let's say I've never used Golang before. Can anyone give the run down of what the language does and why you prefer it? Feel free to touch on drawbacks as well.
Part of a new series! Feel welcome to dip in and weigh in on a past question.
Let's say I've never used Golang before. Can anyone give the run down of what the language does and why you prefer it? Feel free to touch on drawbacks as well.
For further actions, you may consider blocking this person and/or reporting abuse
Michael Di Prisco -
Rizky Darmawan -
Arpit -
Yash Jaiswal -
Top comments (38)
Coming from scala, clojure, elixir viewpoint, the golang ecosystem is huge and many vendors provide bindings. From a python, node view, golang feels a little smaller.
Man, u've bee sleeping in dough; niche background
In brief, GO is a blazingly fast, statically typed programming language that outperforms so many damn dynamically typed languages.
FYI: There is a go version of docker-compose called compose v2. Worth a try. You will never regret that.
Super fast pr reviews because there are very few choices to make. I don't love go, but that seems like it's strongest selling point relative to scala. It kind of reminds me of the goals of "basic English".
Most if not all languages can be used to be build distributed microservices. With it's focus on package oriented design and concurrency primitives, Go was actually made to build distributed systems. Given how much companies need to scale, it makes Go an excellent tool in their arsenal.
Go also has made the brave decision to remove powerful abstractions like inheritance, function overloading, etc. These may be nice, but they can often bite us in the ass later, and I don't think any developer is trustworthy enough to not to abuse them, especially when they're on a deadline and it's a Friday afternoon.
I think Go is amazing for problems dealing with I/O and where a long term solution is needed.
It may not be the best option for something where you need to be as memory efficient as possible.
Also, as much as I dislike NodeJS, I'd use it over Go for prototyping. An opinionated, statically typed language isn't great for throwing together a disposable prototype.
First time I've seen that as a euphemism for procedural.
Go FAQ: Why build concurrency on the ideas of CSP?:
"Experience with several earlier languages has shown that the CSP model fits well into a procedural language framework.".
It's a procedural language with a built in coordination model (for something functional you have go with something like Erlang or Elixir).
Just look at the mascot.
"It must be familiar, roughly C-like. Programmers working at Google are early in their careers and are most familiar with procedural languages, particularly from the C family. The need to get programmers productive quickly in a new language means that the language cannot be too radical."
Go at Google: Language Design in the Service of Software Engineering
In Rich Hickey's terms it tends more towards easy (familiar) rather than simple.
What's the basis for learning Go in a day?
I like pointing people who already know programming to "Effective Go". If you have no experience with concurrency and threading, that will take some additional learning. Don't go in there just YOLOing channels and goroutines left and right.
My rules for goroutines:
Run(ctx *context.Context, args...) error
Pros:
Cons:
Go being learnable in a day is a huge misconception about the language. Basic syntax yes, but it takes months to figure out proper package- and project structures.
Why so long?
The language is very opinionated on how to implement things - for example, reading a file or running a web server. There's only one way to do this in Go.
But Go is very un-opionionated when it comes to your code layout and project structure: There is no "default structure", you can create packages as you want, you create files as you want, you can place multiple types and functions within a single file, you can define interfaces inside the package that uses the interface or inside the package that provides the concrete implementation of the interface...
It just takes a time to figure out how to properly structure the code. Go is very liberal in this concern and each project should use a structure that fits best.
Why is it unopinionated on how to organize types and functions within modules?
In other languages, say, Java, you'd create a file
Order.java
for yourOrder
class. There's no such convention in Go. You can create a file calledorder.go
containing anOrder
type, but other types, constants and functions may also be in that file. Go simply doesn't have any restrictions regarding the code structure, and that allows for the best-fitting solution for your use case on the one side but also many possibilities each with their own pros and cons on the other side.Thanks.
I was more curious about why the leadership is opinionated about error handling, but isn't as opinionated about module conventions.
I understand that in both functional and procedure languages, there is a much larger degree of freedom in how you group together items inside of modules. I haven't done a lot of c programming, but I assume it has very well established patterns for organizing modules by now.
Some comments may only be visible to logged-in visitors. Sign in to view all comments.