236 points · by keyle · 3y ago · 314 comments
As far as languages go, Go is relatively well-funded. You can of course imagine hypotheticals where there was more money behind it, but on the spectrum of PLs it's got more support than most. And further, I think the core developers who work on it like rsc and bradfitz are objectively great implementers. Despite that, the majority of complaints about Go are a lack of language features; you even see some in this thread.
In other words, a language with an above-average amount of effort and ability and 14 years behind it is still perceived as feature poor. But imagine how much more time it would have taken if they had taken on a larger scope, like if they had gone through all the complex design process for generics up front.
For me it is a great lesson on how important reducing scope is for shipping, and also how a reduced scope enables you to more judiciously choose what is important. If they had decided that features X, Y, Z were table stakes for their launch they would never have had the time to do the other things that I think have made Go great.
They have very deliberately tried to minimise the feature set in order to keep the language easy to learn. C++ is probably the canonical example of a language which hasn't kept the feature set tractable but I'd even argue that Python may have fallen into this trap in recent history.
I thought this was common knowledge. They made whole conference talks about it.
I searched around, but didn't find anything. Perhaps the title is something different than "go minimal feature set".
I think the total cost of debugging hours often ends up being several magnitudes higher than the cost of development hours. At least for me, the process of debugging is something that involves scanning the code to load up my brain with as much possibly relevant context as I can and then try to analyze what parts of that might explain the seen behavior. A carefully designed language should help to both minimize the size of that context and the amount of linguistical gotchas that are part of it.
If I'd use an AI assistant, that lets me ask more pointed questions. Wouldn't that improve the assistance the AI can provide?
I like Go in that regard. You can keep the whole feature set in your head, and read/simulate the code without getting confused, and I’m telling this as a C++ fan.
Come on HN, you're better than this.
Rust, Kotlin, Swift, and Dart are the main ones I'm looking at. Rust and Dart had an official package manager long before Go did. All four have had some form of generics, at least the first three have sum types, null safety, and many other features that are missing in Go. These languages might have as much funding as Go (I don't know), but they've had less time to implement these things.
Rather than funding constraints, it seems to me that Go has avoided adding features because that's not the kind of language they want to design. It may have led to more polish than some of the languages listed above (I personally prefer programming in any of the first three to programming in Go), but it's not a given that Go would have taken longer to build if they'd made the scope bigger.
Go definitely has much more funding and developer hours put into it than open-development languages like Python - that’s got to be a good thing for the language.
On the other hand, would you choose to build a long-term business on top of Go, given that all that support comes from one company? What if Google decide that maintaining Go is no longer in their best interest?
a) Absolutely and b) already done.
Go is stable. The language is battle tested. It works as advertised. It is open source. Even if google pulled all funding (unlikely, since alot of their architecture seems to use it), the language is maintainable.
And btw. Languages don't have to continuously evolve to remain viable. Modern languages seem to indicate otherwise, but that behavior is what Go actively avoids; adding everything and the kitchen sink into the language as soon as some other language has it. If Go showed one thing, it is that PLs don't need to add as many features as possible.
And just to prove that point: C is still a top rated language in terms of usage. When was it last updated? C17 came out in 2017, and did not add new features. It superseded C11, which came out 6 years before that, also mainly standardising things that were already de-factos in most compilers. Before that was C99 in 1999, and before that is only ANSI-C and K&R.
First of all it’s not just an issue of maintaining the language itself, but all of the associated tooling as well. Second of all, it’s not just that Google could pull support, but that Google could choose to prioritize their own needs over the rest of the community.
And btw. Languages don't have to continuously evolve to remain viable. … If Go showed one thing, it is that PLs don't need to add as many features as possible.
Go advocates say this often enough that it’s honestly beginning to come off as an insecurity. And I would be concerned about cultivating a community around “less is more, Go should only evolve as a last resort”.
Moreover, keep in mind that the primary selling point of Go were goroutines. At the time Go was particularly well suited to exploit a gap left by other languages. Fast forward to today and Go has become a significantly less compelling option.
And just to prove that point: C is still a top rated language in terms of usage. When was it last updated?
Projects written in pure ISO C are relatively few and far between. In fact many high profile C projects are exclusively tied to one or two compilers. Furthermore, ISO C has delegated a lot of functionality to external standards like POSIX instead of giving them first class support, not to mention the plethora of nonstandard language extensions found in many compilers[0]. In other words, ISO C has stagnated, albeit C23 is a big update, while the C language has evolved.
Anyway, as I see it, golang is basically a dead end as a PL. It doesn’t interface well with other languages, it doesn’t substantially differentiate itself as a PL, any nuance you encounter with the language is likely to never be fixed, it’s a poor language for writing great libraries and/or abstractions, etc. That said, plenty of great businesses have been built on top of languages like PHP, so it can definitely work. Personally I don’t expect anything like another kubernetes coming out of the language again.
> Go is stable.
But, past isn't a guarantee of the future. It was stable before, but who's to say it will be in the future? The fact that it's "owned" by a single entity should make you scared that it wont, because the whim of that entity is what can change any property of the language.
Additionally, Go has no standard, no alternative implementations to speak of. All of this should have you concerned for the future (but you seem to ignore the obvious dangers).
> It works as advertised.
It's the opposite. Languages with single (or one primary) implementation advertise how they work. Go is implement first document later language. The public discussion is for show because public doesn't control how things are being implemented. The Go dev. team may listen to everyone's opinion, nod in agreement, and do something else entirely, and nobody will hold them responsible for the discrepancy.
> the language is maintainable.
By who? How did you come to this conclusion? There's only evidence to the contrary of your argument. There isn't any other organization that's interested in maintaining Go if Google were to go away. At least nobody expressed such an intention publicly.
> Languages don't have to continuously evolve to remain viable.
This is demonstrably false. Hardware changes, operating system interfaces change. If you don't keep up with these changes, eventually your language becomes irrelevant. To further illustrate this point: today, versions of Python 3.7 and older cannot be built from source on modern Linux with current GCC. Python's dependencies on libffi and libssl are incompatible with their current interfaces, and so the language can only be built with older libraries (but then the operating system needs to use the older ones too) or statically linked with those libraries, but in case of libffi that doesn't help because it will not work for its intended goal. And the further back you go, the less likely it is that you will be able to build and use any version of Python. Bet, the same is true for Go.
> When was it last updated? C17 came out in 2017
C standards don't get implemented on the year they are released. Bet you Microsoft probably doesn't fully implement this standard. (I don't know, it's a guess based on past experience using their tools).
In more broader terms, I have no idea why did you bring C into this argument. C is an entirely different language in terms of governance, support, standardization... It's basically all things that Go isn't. Standards and multiple interested vendors ensure the survival of the language. The whole argument against using Go for long-term projects is that it's not like C. You trying to point out that C is used successfully for long-term projects doesn't help to show that Go would too. If anything, you should suspect that it won't, because Go is the opposite of C.
What makes you so convinced "someone" will take over? Is there anyone who offered themselves in such capacity? I've heard a lot of people making similar bold claims about Python 2.X -- sure, someone will step in and maintain Python 2.X indefinitely... Well, no one did.
If it’s good enough for Kubernetes then it’s good enough for any business.
Pretty sure Internet and cloud will not go anywhere if Go vanishes tomorrow. Even if you need containers, there are plenty of tools that don't use Go, and give you similar service.
I've lived enough to see technologies with humongous popularity die in a matter of years (eg. Flash). Those who didn't believe Flash would die made very similar arguments about how certain things would be "impossible" w/o it. Not sure who am I quoting here, but there's this saying that "cemeteries are full of indispensable people".
Like Java? Or c#? Go is hardly unique in that it's developed primarily by a single entity.
...but even if Google abandoned it, it seems like you're making the assumption that no one in the world would continue developing an open source project, and the source would just become unusable, or something? It's not like Google can just turn off go lmao
That's only possibly by reducing scope. I don't think more people help, because you can't really divide and conquer language design.
(As far as I understand, the early project was something like "take Ken Thompson's C compilers and add goroutines, garbage collection, slices, and interfaces")
I don't use Go regularly, but I've also had some very good experiences with it lately.
They have kept the tools simple and predictable. Getting started is a breeze.
The MIPS support worked surprisingly well, e.g. on a machine with 64 MB of RAM.
I've had and still have a lot of gripes about (mainly being a sort of closed ecosystem), but you can't deny that it works well, and is a big achievement.
For me the issue of Go is that it has a focus on backend services and doesn't try going much further than that. (And also it's probably a bit too plan9'ish)
At the same time it's good that it has a focus, because that's what made it get where it got
And I love Go. It’s not perfect at all. But I get things done with it, there are tons of high quality modules to depend on, the tooling is great, concurrency / async programming is a breeze.
Thanks, authors and community.
https://github.com/golang/go/issues/39568
As far as I know every other language standard library still allows CN to be used to validate the hostname when the SAN field doesn’t exist.
As discussed in the link, CommonName has been deprecated in x.509 serverAuth certificates for decades, and all major browsers dropped support for the field (even as a fallback) years ago.
Tried to gradually upgrade projects written Ruby and Python, that were not touched in 10 years. The dependencies were based on C extensions that depended on libs not existing anymore. It was even impossible to get the original version compiled, because in was dependent on a Linux distro version that doesn't exist anymore, even as docker images.
That was the hard lesson: depending on dynamically loaded libs means you need to constantly maintain the project and even if it has no visible bugs, or doesn't depend on the code having security vulnerabilities, you need to adapt it to evolve together with the libs, and that is needed even if you actually use only what's "old" in the libs. But we're not saving every megabyte of a disk space anymore like in 90s. Switching to static compilation does wonders for maintainability.
In go, code from a decade ago should just work, unless the underlying system changes too much.
Are you sure ? I don't get that feeling from HN at all.
"Choose Boring Technology": https://boringtechnology.club/
Not in the sense that it's a bad language, but just that it's not used much anymore.
https://trends.google.com/trends/explore?date=all&q=%2Fm%2F0...
(Funnily enough, it still absolutely dwarfs Rust in Google Trends, which highlights how much HN, Reddit and such are echo-chambers)
What are you talking about? Go is a popular language. Many of the successful software projects released in recent years are written in Go.
Completely different. In Rust when you spawn a thread [1] or an async task [2], you'll get a handle from which you can check if a panic happens inside the thread/task. Even if you ignore the handle, a panic inside a thread/task won't crash the entire program.
---
It did not though?
- threads implicitly catch_panic at their boundary, and convert that to a `Result` which you can receive when you join on the thread: https://doc.rust-lang.org/std/thread/type.Result.html
- in theory an async runtime could shut down on panic, but tokio at least does not, much like `std::thread::spawn` it'll catch_panic and return a JoinError to however is await-ing the joinhandle: https://docs.rs/tokio/latest/tokio/task/struct.JoinError.htm...
If you drop the handles, the error just is not signaled:
- sync: https://play.rust-lang.org/?version=stable&mode=debug&editio...
- async (tokio): https://play.rust-lang.org/?version=stable&mode=debug&editio...
So panic is supposed to be “I’m not sure what to do now, I don’t care if my caller knows”?
No process running outside of kernel space ever has any business panicking. Throw an error and move on with your life (or don’t, that’s fine too) but don’t punish your caller by forcing it to crash because you failed to foresee X, Y, or Z circumstances.
No, absolutely not!
Panics are the result of conditions that absolutely should crash the program! They are not errors, they are not similar to exceptions, they are conditions that should not occur, and thus if they do occur, either the program itself, or the platform it is running on, has a problem that needs to be solved before the program runs again.
If a cars fuel is running low, it should turn on a warning light and inform the driver that he should find a gas station. If a piece of the road is suddenly missing, the car needs to stop.
If a panic occurs, I don't WANT the program to continue executing! That would lead me right back into C land, where an out-of-bounds memory access would silently start to poison my program and crash it days after the actual error ocurred, if i'm lucky! If I'm unlucky, and the process needs to be sufficiently privileged, it would kill the server, again several days (or weeks) later, with slim-to-no chance for me to figure out what even went wrong.
This is a bit like worrying that your programming language won't prevent a third-party library from sending a SIGKILL to your program or that it doesn't prevent third-party libraries from delete your entire file system.
No general purpose language protects against malicious or stupid code.
Third party libraries have bugs sometimes, and other times our usage of them can create bugs. Nothing like a SIGKILL or anything malicious. That's just the way things are and will be. And breaking down like this in dev can be fantastic!
But when a once in a blue moon issue crops up in prod and all other connections are dropped, the fact that a simple defer+recover couldn't have been preemptively placed on all goroutines is a huge nightmare. I'd even take a "you can add defer+recover for any goroutines created further in this callstack" - it's rare that libraries spawn goroutines, I'll already know which ones to trigger that behavior on
Yeah, this is one of the weird things, to say it mildly, that Go does that is hardly mentioned anywhere. Most people don't know about it until they themselves first encounter the nightmare bug similar to what you said.
Not at all. I knew that panics in Go shouldn't be used for error handling in general.
> Third-party libraries should virtually never panic.
True, as true as 3rd-party libraries shouldn't have any security vulnerabilities. But we don't live in a perfect world. Bugs happen.
> This is a bit like worrying that your programming language won't prevent a third-party library from sending a SIGKILL to your program or that it doesn't prevent third-party libraries from delete your entire file system.
Very different. Your examples are intentional and malicious actions. What usually happens is due to bugs.
> No general purpose language protects against malicious or stupid code.
Are you implying that all bugs are caused by either malicious code or stupid code? Panic-related bugs are often due to the billion dollar mistake [1] that Go's team refused to solve.
---
[1] https://www.infoq.com/presentations/Null-References-The-Bill...
IIRC, the Go lexer/parser itself relies on panic/recover to handle errors[0], in an exception-like fashion. Granted, it's one unusual case, where the code is split in a multitude of mutually recursive functions.
[0]: https://github.com/golang/go/blob/master/src/go/parser/parse...
How is a panic crashing a program a bad thing?
Panics are not Exceptions. They usually are the result of something happening that should crash the program.
Unless you're working on a CLI tool that is short lived anyway (and represents a lot of projects using Go).
Even if you could somehow prevent your program from crashing internally, it could be killed at any time by the environment it's running in, up to the cleaning lady tripping on the power cable.
That's why it doesn't make sense to try to prevent crashes. Instead, programs should be capable of resumption irrespective of when they were killed. Resumption should be facilitated by supervisors layered on top of the program, as needed.
Current state of affairs is that third party libraries panic where they shouldn’t, programs don’t defer where they should, recovers cause deadlock due to non deferred mutex releases, that assumed panics are panics and not exceptions. On top of that we have to live with the verbose error handling that still isn’t water tight.
The stack I settled on:
Postgres + sqlc
templ (kindah jsx for go) + htmx
Barely have to write any js/ts now
Interviewer: What would you say if man walked in here with no shirt, and I hired him? What would you say?
Will Smith: He must have had on some really nice pants.
Go has some really nice pants i.e Simplicity with good enough performance, backed by big corp.
Simplicity scales!
Java, Python, C#, Javascript, PHP, C, C++, Ruby, are all from the previous century.
There is Swift that is roughly as old as Go and Rust that is more recent, but they're not nearly as popular as Go.
I've seen pretty convoluted code bases otherwise that showcase the engineering muscle of the individual and how they can employ almost every single language feature even to a very narrow business domain.
That is an assertion which makes no sense to me. Go is not a minimalist language, it's a restrictive one. Although it made different choices, it's in the same vein as Java, and certainly no Forth, or Smalltalk.
> It is hard to over engineer when there's no inheritance, no meta classes, no properties, iterators, decorators and such.
None of that has anything to do with over engineering?
Not to mention, if you every spawned a container, there are 99.9% chances that somewhere go was involved along the way. There are other run times around (rust comes to mind) but none is production ready.
Point is - restrictive should have restricted. It hasn't
Minimalist isn't restrictive.
EDIT: Added docker and restrictive not the same as minimal.
The language is restrictive, in that you can't "play" with the language, it has a very fixed syntax / structure and no real way to make your own, much like Java or C#: no macros, limited runtime reflection (to say nothing of wholesale manipulation), control structures are heavily syntactic, etc...
Hell, the designers built in a bunch of collections and behaviour (and special syntax) around those collections because they either did not want to or could not be arsed to make the language able to express them.
> Whole cluster orchestrators have been built with go (k8s, nomad), whole databases have been built with go (cockroachhDB), whole authentication systems have been built with go (zitadel, authelia), whole web servers have been built with go (Caddy, Traefik), whole DNS servers have been built with go (CoreDNS), whole key value stores have been built with go (etcd), some encryption has been built with go (age) so how it is restrictive and why didn't it restrict all those use cases?
That has nothing to do with anything? Literally all you're stating is "the language is turing complete therefore it can't be restrictive".
> Minimalist isn't restrictive.
No, it's not. And neither is the reverse.
And go is restrictive, not minimalist.
Most over-engineering in the wild overuses inheritance. That's why we see more monstrous "enterprise" code in Java and C# than languages like Go and Rust that lack inheritance.
Rust has a completely different niche, and maybe wait a bit before claiming anything like that about Go - it is not being used for that kind of enterprise systems just yet.
You're not making any sense, and you're not providing any sort of argument either.
The flexibility of the language and its syntax. The more constructs are syntactic, the less minimalistic it is, and Go is a very syntactic language.
> I've always considered Go to be minimalist in terms of available tokens to the programmer: https://github.com/e3b0c442/keywords/blob/main/chart.png
No language on this chart has even a passing resemblance to minimalistic. I don't think anything does when it reaches double digit keywords.
For reference, I believe Smalltalk has 6.
And forth is more complicated because it doesn't really have keywords at all, and barely any syntax, instead it has assembly-coded / runtime-provided words (~functions) and variables. SectorForth (https://github.com/cesarblum/sectorforth/) is down to 8 builtin words, 2 IO words, and 5 variables (milliforth packs those behind a word instead). And so far 2 of the words have been found unnecessary / redundant.
I've been programming in Go professionally for 6 years, and it covers 80% of usecases well, but that last 20% is really tricky
And because this is HN, I have to mention of course you can over engineer current Go as well. But it's not "fun".
I was there, along with many others, and I'll never forget that this language has a dumb name and it could have had a much better name:
I’m not asking for the full Java streams equivalent, it would just be nice to be able to filter a slice or perform basic transformations without having to resort to for loops.
I would probably never use these, as I find such libraries are a whole new domain-specific language to learn, and often don't make things much simpler anyway, but here are some libraries where people have done something like this:
- https://github.com/ahmetb/go-linq: modelled after LINQ, but created pre-generics so only recently added some generics features
- https://github.com/samber/lo: kind of like JavaScript's lodash library but for Go 1.18+ (with generics)
- https://github.com/asynkron/gofun: simple library with stand-alone functions to filter, map, and so on
It most likely ticked quite few boxes right:
* easy syntax
* fairly extensive std lib
* easy memory management & mostly painless GC
* easy shipping of dependencies (everything in one file, including runtime)
* order of magnitude less tricky parallelism.
In a world where Golang doesn't exist, quite a few recent software would probably look really different:
* Etcd but in Java (hello Zookeeper)
* Terraform but in Python
* Docker but in C/C++ or Python
* Kubernetes, but in Java and/or Python and/or C++ (hello Mesos) * Prometheus, but in Java and/or C/C++
And honestly, for most of these, either because alternatives in such languages do exist and mostly failed, or from performance/stability concerns, I think we would not have been better of.
For example, if you were to create a complex native application (browser, game, cad software, etc), C++ is still probably the best choice. For data manipulation/transformation or glue scripting, Python is still a more convenient choice. If you want to structure an extremely large codebase and depend on tons of "Enterprisy" stuff, Java is most likely a good choice. (note: I'm caricaturally oversimplifying)
Also software is rarely created in a vacuum:
1) software teams have certain skills and habits
2) new software is often created in a preexisting context
3) In fairness, language choice is often not that critical
4) Developers can be extremely vocal about technology choices, often way beyond the reasonable
For all these reasons, even if we fall right in the Golang niche (small to medium size web api/app, "devops" tools/infra management and partially, some DB use cases), choosing Java/C++ over Golang could actually be the right choice.
Thank you go developers for embracing TAB.
Is there anyone in the same boat and are there ideas how I can make myself get good with at least one of these trending languages ?
Writing practical code is harder if you're not used to it because it enforces discipline that a lot of coders in other languages don't care about like the mutability of a variable. For me it just clicked because that's something I always struggled with in other languages and it frustrated me that I wouldn't know how a variable was supposed to be used. The fact that in rust that concept is built into the language makes me excited. If someone doesn't care about that kind of thing then I can see it being very frustrating.
With Golang, I would strongly recommend ignoring all advice. People kept saying it's easy to understand, that it's like python, or that it's like a better C. Forget all that, try to approach it from the ground up as it's own separate thing, dive into what interfaces, slices, etc. actually are. Then write a bunch of practical go code like a webserver, then a lot of go idioms become a lot more obvious. I really feel like there were some lanuage design decisions made where one thing exists because of another feature, so writing some code makes those links obvious as opposed to learning each feature independently.
When doing Ruby after only using Go for years it was (and still is) very tricky for me to deal with error handling and figuring out what kind of object I'm dealing with.
If your issue is that the syntax is too complex then you've got a problem since semantics are usually way more complex to grasp than syntax.
Rust's learning curve is waaay steeper than that
The linter/autocompletion/auto-fix/refactoring/etc made it much simpler to a avoid having to rote-learn the syntax for functions, lambdas, structs, etc. To go with that, the error handling becomes much easier to learn because the editor is able to tell you when you've got the wrong number of return values / wrong type of values.
Yes, the compiler does all of this, but the way it happens in real time using the same keybindings/UI/UX that I use for my day job makes it all that much easier.
Try the interactive Go Tour, and review the Learn X in Y Minutes page for Go to get familiar with the new features. Then try building a fun toy project in it. Go makes it easy to build web servers, so maybe a REST service is a place you could start.
I use many tools that are written in Golang, and I am very grateful for it.
docker, duf, chezmoi, fzf, croc are few tools I use that are written in Golang.
Huge, working (unicode, streaming, etc..) stdlib that doesn't require 20 different third party packages to get a server running. Also has built in formatting, testing, and benchmarking(!)
Compiling is so fast I can write tests that run on save in ms showing me outcome before I start typing again and actually enjoy TDD. This isn't possible with TypeScript, C++, or Java.
I'd be happy for every other language except Rust to disappear tomorrow, but aside from that Go is just nice and unfussy to get really good performance with a quick dev story.
It is 100% possible with Java.
At that time it was this cool but incredibly niche new thing...and now that gopher is iconic and the language is extremely popular. Who would have guessed what it would become?
I think becoming the go-to language in the cloud native/kubernetes landscape has really helped the popularity as well.
Personally between Go, Ruby, and some Bash I never feel tempted to reach for any other languages to get my work done.
* It's name
* Nils
* Pattern matching
* Enums / Sum types
* Generics
* Error handling
Other ecosystems have recognized that pattern matching and sum types are the way forward as well as null safety.
Java is also the most prominent example of a lack of null safety. Once Java gets around to fixing that in the next century or two, then Go will really be behind.
Is it perfect? There's no such thing. But it's very easy to get to work and start solving problems with no headache, which is probably why so many very popular tools are written in it these days.
And it performs very well, certainly in comparison with Python.
Oh come on, who doesn't love to see something like this?
[print("fizzbuzz" if not x % 15 else "buzz" if not x % 5 else "fizz" if not x % 3 else x) for x in range(1, 101)]Python has horrible builtin tooling and Go has great builtin tooling.
Go is very restrictive language, while Python is not.
Go has horrible FFI support, while Python has some of the best FFI support.
I think the only thing that is similar between them is both of them are easy to understand compared to most languages.
I mean you don't see people building AI/ML, Data Science lib raries in Go for a reason.
In the words of Rob Pike:
"The key point here is our programmers are Googlers, they’re not researchers. They’re typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. They’re not capable of understanding a brilliant language but we want to use them to build good software. So, the language that we give them has to be easy for them to understand and easy to adopt." – Rob Pike 1
The problem Go solves is that google has a bunch of people who can hack out code, but don't really know the theory of computer science, can't understand high level abstractions and complex type systems... So they need a language for "the average programmer", or as pg would say, "the blub programmer".
They invented the blub language. Blub programmers are everywhere at google, and they are everywhere in the industry, so its primary design goal is applicable to almost every company in the world.
The GC in Go punts the issue of memory management to the runtime, but does so in a largely correct way. In that one way, Go is easier than rust in a way which genuinely does not cause any real production issues.
However, the most important tradeoff when talking about Go vs Rust on this startup-infested hellsite is not related to the quality of code at all.
The goal of a startup is not to produce working production code, but rather to convince VCs of its trajectory. VCs don't care about buggy code. Every company has buggy code, it's expected you have bugs. Normal. Possibly even a good sign. "Move fast and break things". What matters more is the number of warm programmer butts you have in seats. VCs want you to hit your headcount targets, and unfortunately, hiring programmers that will make your codebase a buggy spaghetti mess is much easier than hiring Rust programmers.
Said another way, good code might actually be a problem in startup-land since it will make it harder to meet VCs hiring expectations.
That "key" is making Rust the complexity issue it is. Which is why it is considered so hard to pick up, both by newbies, and by experienced programmers. And yes, I know, there will be people who say "Rust is easy!". Well, show me people who learned most there is know of Rust over a weekend, or who understood a large Rust codebase while still learning the language. In Go, I personally know several people who did both. In Go I onboarded people who never before even saw any Go code, without an issue.
> Golang doesn't really solve the problems of newbies, it just punts the issues to runtime
These are not problems of newbies.
Yes, GCs are an adequate solution to the complex problem of memory management. Most real world production code written doesn't have performance constraints that prohibit the use of a GC.
Rather than being explicitly designed for problems Google was facing, it took a fair amount of time to find a niche (initially, log processing).
I believe that it is very much a problem many entities that aren't Google like to have a good solution for.
These things are quite subjective. In practice though, Go lacks the kinds of features that would make very large scale codebases (the sorts of codebases where "many coders ... work on the same thing") truly surveyable, understandable and easily maintained. I mean, it's not a complete disaster like Python or JavaScript. It has some features to support modularity and programming "in the large". But other modern languages like Rust or even Swift are quite a bit better on that side of things, and it shows.
In practice though, there is a reason why Go is seeing continuous growth in usage, so I kinda doubt that these features of Go are subjective.
> But other modern languages like Rust or even Swift are quite a bit better on that side of things, and it shows.
In what metrics does that "show" if I may ask? Because it isn't showing in usage numbers across projects.
Us mere mortals are trying to pick up Thor's hammer at the end of the day.
Perhaps these features you speak of don't matter as much as we think.
It takes so long for a language to rise to prominence that newer languages like nim or zig are probably a decade away from even gaining a threshold.
I really wish there was a better alternative to golang because it comes so close to greatness: fast compile times, small binaries, GC, great concurrency ergnomics, great for networking (My God! you can just use net/http for so much - it's insane), an attempt at simple code (yea checking err is boilerplate, but it makes error handling clear), a community focused on having few dependencies where it's possible to build something and have it work for years.
But then there's complete bullshit like the nil handling, a lot of the interface design, the horrible enum equivalent, using casing to indicate accessibility, how tacked on generics are, how long it took to get decent package management when there was so much existing knowledge to learn from, etc. There's also some features like sum types that would be really nice to have.
1) nil handling is bad
2) Missing enum/variant/sum type
3) Non-specific dislike of interfaces and generics (care to expand?)
4) Some style decisions, like case-sensitivity
Honestly, that's not a bad score for a language like this. If I were to list off things I dislike about virtually any other programming language, it'd be a lot longer.
It's even more ok, because some type of enum type can still be added without breaking the language.
I do agree about nils, though, that design is just bad and we're probably stuck with it.
What really irks me about nil is that it's typed, and the (runtime!) type is part of the comparison. So checking "err == nil" can return false in case of "nil == nil" if you ever return a concrete error type rather than the interface. Now that is some crazy nonsense, and probably unfixable at this point.
It’s called Java
Erlang/Elixir would like to have a word ;)
While Go has another philosophy in mind, it works for many people. Together they opened the door to make concurrency a more important language feature and undoubtedly influenced other popular languages like java.
What I've been finding is that primitives it gives you are easy to use, but extremely hard to use _correctly_. My first major PR in go had a week of back and forths as more experienced go programmers on my team pointed out the many, many places where my concurrent code was buggy -- places where I was receiving without selecting over the context being cancelled or some close-channel, places where I was sending from a goroutine that had to have a nonblocking basic loop without guarding with a default clause, places where I was using an unbuffered channel where pathological goroutine scheduling could result in a deadlock, places where I was using non-thread-safe data structures in places that could theoretically be mutated by multiple goroutines and without spamming mutexes everywhere, etc. etc.
And sure, I'm relatively new to go. I'll learn these things and get better. But the contrast to some previous work I'd done in Elixir was striking. In Erlang/elixir, _the obvious first thing you try is generally actually correct_. And it gives you standard ways of working built on top of the primitives (genserver calls etc.), so you don't have to buggily reinvent the wheel every time you want to send a message from one goroutine to another with a reply, or need to tear down a bunch of goroutines simultaneously.
I have a highly-concurrent elixir service I wrote several years ago, by myself (early stage company, no code review), still in production. It pretty much never has problems and basically just worked from the start. If I'd tried that with go, without a bunch of experienced go programmers to point out all the subtle race conditions, I'd probably still be dealing with a long tail of data races and deadlocks years later.
[Warning super hot take]
If you are creating a backend service, the language of choice is clearly Go. Get productive within a week, straightforward to read, compiles to a single binary (easy deployment), suited for serverless functions, low memory usage , excellent ecosystem, static typing, composition over inheritance, sane dependency management, Goroutines instead of async/await, super fast compile times and very very performant.
[Vs Language]
Python: Very slow, dynamic typing, async await, multithreading is an issue, deployment not as straightforward, messy dependency management
Java/C#: On the heavy side for resources, verbose and various design patterns, async await, around the same performance as Go
Nodejs: Async await, slower than Go, node modules, deployment not as straightforward, single threaded execution
Rust: async await, long compile time, high and long learning curve, on average will take longer to develop in Rust, sparse talent pool, faster than Go BUT for the effort it takes to get there, don't think its worth it and the extra performance is mostly not worth the above trade-offs (unless you operate on the scale of Discord)
Yes there are issues with Go. No doubt. What it gives you by default is a language designed for the web backend. No contest in my opinion.
I’ve enjoyed my initial foray into it so far. I like how small the surface area of the language is. I felt comfortable reading the code and starting to make changes within a couple of hours. While I love fancy complex features as much as the next nerd, there is something to be said about not having enough rope to hang yourself, especially when working in a team.
I like having standard first-party tooling including a formatter. Goroutines seem super neat, as do channels. People say Go’s generic system is a little tacked-on, but PHP doesn’t have one at all and Swift’s can get quite complex, so I’m happy with it.
I did find myself disappointed by a few things though, mostly around the type system. People consider PHP to be an untyped mess, but these days it actually has a reasonably expressive system that offers a lot of guardrails when paired with a static analyser. Swift has probably my favourite type system of any language I’ve used. Some complaints, in no particular order:
I think zero-values are a mistake when you have a compiler that could make usage of uninitialised variables a compile-time error (Swift does this). I want the compiler to yell at me when I forget stuff, rather than just rolling with it until it inevitably causes some logic error somewhere.
I sorely miss sum types and the ability that affords to strictly model a domain. It’s all well and good having linters that complain when I don’t handle an error, but I’d much prefer a compile-time guarantee that the return value of this function is a Value OR an Error, with the compiler forcing me to handle both cases. Granted PHP doesn’t have this, but it’s also a nearly 30 year old language that grew out of a simple templating engine. Swift is of course militant about this; you can’t even write a switch statement without handling all cases.
Further to the previous point, there doesn’t seem to be a particularly ergonomic way to model optional values, besides using pointers and checking for nil. While PHP doesn’t actually enforce that you check before doing something with a value, nullability is part of the type (if one is supplied). I can define my function to take an `?int` in order to accept null as a value, but if I define it with just `int`, I am guaranteed to not receive null (albeit at runtime, because there’s no compilation step). Swift of course has the Optional enum with the associated syntactic sugar to make this very nice to deal with. It would seem that in Go, I would need to add `if ptr != nil` everywhere to have the same sort of guarantee, though I am very new to the language so there is perhaps some better way of handling this.
No ternary operator…I accept the argument that nested ternaries are a readability nightmare but come on guys, given the infrequency in which they pop up in real-world codebases it doesn’t justify the visual noise that is “var-if-assignment-else-assignment”.
Anyway, despite my griping it’s a neat language, just a shame the designers seem to have deliberately ignored so many advances in type systems over the last few decades.
Doesn't Google owe a couple hundred million in royalties for the name to the ancestors of the Chinese and/or Indian people?
In my estimates N = 6, more less
People don't bash languages they don't care about, only languages they have to work with when they would have picked a different one if they made the call.
(Funny that it applies almost exclusively to Rust folks; I never saw any negativity towards Go from Zig folks, for example).
These individuals will of course downvote this comment as well as my previous comment, because they are so deeply emotionally tied to their choice of language that they hate even mentioning the mechanism; but I don't care about my points here, instead I care much more about the truth and honesty
I really love the fact that most of the time people from the Golang community would like to say "look what I've made with Golang!" That's the sign of success: the users (here I mean general devs) should not care too much about the language per se, they still have applications to ship!
Rustaceans tend to talk more about cool new language features. They are critical to what Rust does, but maybe they have also got too much attention.
As I said: typically those devs want to use Rust but their team or employer decided to go with Go instead. So they keep writing Go wishing they were writing Rust instead (and maybe secretly hoping to convince their colleagues and bosses to switch to Rust).
So it happens precisely because Go is popular and get selected for those projects.
Now I also actively hate on its ecosystem.
― Bjarne Stroustrup, The C++ Programming Languageand Go still not good fit neither for graphics, nor ML, no scientific computing, nor data engineering, nor embedded devices, nor VR, nor games, nor self-driving, nor industrial automation, nor robotics, nor video processing, nor desktop applications, ...
[1] not a good one.