4 ms·
Why you should use Go
- black_13 2y ago[dead]
- deleted 2y ago[deleted]
- zxilly 2y agoThe parts of Go that make the most sense to me are the default static linking and the easy cross-compilation. rust does part of this, but C-dependent crates are easy to introduce (e.g. openssl-sys) and directly cause cross-compilation to be a disaster.
- _mlbt 2y agoWhat do people use for authentication in Go web applications? To me that’s the big missing piece. Just about everything else is in the standard library.
- perryizgr8 2y agoI wrote my own. I know you're not supposed to do it, but I copied the django implementation as best I could so its probably OK. It's not much work actually.
- lormayna 2y agoExactly, I am looking for a suitable authentication library in go since long time, but I cannot finding anything. Things like authboss are not really usable at all.
- rareitem 2y agoNot a library, but you can use Lucia auth (https://lucia-auth.com/ https://lucia-auth.com/) as a guide to make an auth system yourself
- wg0 2y agoCheck authboss, casbin and casdoor.
- ffo 2y agoDepends on your needs but Zitadel can do that for you. We also have a good oidc library that helps you plug into systems that support open id connect.
- foolfoolz 2y agogo has excessive verbosity, poor error handling, rough edges for package/dependency management, and forces you to use interface for too many things. it’s not a bad language, but i would not choose it for a new project or base my company around it
- grouchypumpkin 2y agoI'm really curious, which language is better than Go in those regards? Because I find Go is better than Javascript/Typescript, Java, Python, C++, C# on all of those.
- wbl 2y agoMost people would regards Standard ML as having some very sophisticated ideas in this regard.
- codr7 2y agoC# runs circles around Go, imho. What is it you find better in Go?
- throw4950sh06 2y agoGo is limited. There are too many ways people in my company can fuck up C# code, it's much harder to spend time moving around letters with Golang.
- codr7 2y agoSure, that's a risk. But force feeding everyone Go is worse. Code reviews would be a more constructive approach to the same goal.
- throw4950sh06 2y agoI can't code review every one of 150 devs under me. I can't depend on heroes saving the day. Heroes go do their own thing eventually.
- groone 2y agoAll of these points apply to modern dotnet as well
- teqsun 2y ago"because you want to work for Google" /s
- School-Cotton 2y agoI can’t stand go. It is painful and annoying to write compared to almost any modern language. Yes it’s simple, and makes it easy to write concurrent programs using one particular style of concurrency, which are about the only good things anyone can say about it. The proponents of go seem to have an almost cult-like devotion to simplicity. They think adding any facility for abstraction makes a language into a complicated mess like C++, and any type system feature that didn’t exist in C makes a language into an ivory tower academic plaything like Haskell. The way the author talks about spending all day writing a perfectly beautiful, inscrutable piece of Rust code is an example of that. Yes, there are a few things in rust that are a bit harder to understand, but not to such an exaggerated extent, and that strawman is really not the typical experience when writing Rust. It’s very unusual for an experienced user of any mainstream language (except C++) to have any real difficulty understanding what a given piece of code does.
- silisili 2y agoI guess I'm part of that cult as I value simplicity greatly. Heck I was even against generics and iterators, though the former has grown on me a bit. One question I ask in earnest, why do people not just use another language rather than try to get features jammed into Go? There are so many good ones out there now, it feels like a person can choose something to their own liking. If it's being forced at work, I guess that makes some sense, but I'm also a big proponent of 'when in Rome.'
- School-Cotton 2y agoThe thing about simplicity is making the language simpler often makes programs themselves more complex. For example, in a language without generics, if you have 10 different versions of the same function that only differ by a type parameter, you have to either write them 10 times (meaning anyone reading the code has to read 10 different functions), or you have to write some code generator (meaning anyone reading the code has to now understand your code generator). And, all this cost in the complexity of programs is to avoid something that, in my opinion, _barely_ makes the language any more complex. So you're not uniformly increasing simplicity. I do agree that when there is a way to make a language simpler without any other downsides (e.g. making programs more complex or error-prone), it should always be done! Most people, even Go programmers, would think it was silly if you couldn't define your own functions and had to copy-paste blocks of code everywhere, so clearly they aren't against abstraction in principle. And I don't think generics is a particularly more complex form of abstraction than the ability to define functions is! The fundamental difference is not the level of abstraction, but just that _it didn't exist in C_, and the version of it in C++ (templates) is extremely difficult and unwieldy. So presumably that's what the designers of Go were afraid of. > One question I ask in earnest, why do people not just use another language rather than try to get features jammed into Go? I have to use Go because I am working in an ecosystem that is entirely in Go. Rewriting it in another language would be much more effort than is feasible. When I work on personal projects not for work I don't use Go at all. Also, not everyone uses Go because it lacks features for abstraction; there are other reasonable reasons to use it, for example if one likes the Goroutine-style concurrency model.
- xyzzy123 2y agoThis horse has been long flogged to death. My list: Mostly fits in my head, gc, not horribly slow, boring concurrency, low effort cross-compilation, good distribution story. It's contentious but I like the "low abstraction ceiling". Go punishes people who want to turn everything into a framework or abstraction and rewards people who just knuckle down and write the code that solves the actual problem instance. Is it the "best" programming language on any single axis? Absolutely not. Are the ergonomics right for getting stuff done? Yep, at least for this commenter.
- candiddevmike 2y agoEven if you do discover a better abstraction, I find Go's tooling makes inevitable refactoring less terrible than other languages. I can easily see where I "broke" code--gopls makes fixing things really easy.
- School-Cotton 2y agoGo is not the only language with an LSP implementation. What other ones are you comparing gopls to?
- GaryNumanVevo 2y agoGo is terrible for writing frameworks, because time and time again it picks "simple". Look at generics, people inside google were practically begging Pike to consider adding them, as it would make Go code a lot more flexible, but he held out for years. It's "simple" if you're just gluing other people's code together, and don't get me wrong, having a single portable artifact + run time is amazing, but as someone who's built a KV store engine with Go, you hit the rough edges very quickly.
- zactato 2y agoThey really committed an original sin by omitting generics in early versions of Go, it was added in more recent versions, but too late IMO.
- p2detar 2y agoStarting a new side gig with Go next month and I’m pretty excited. It’ll be my first big Go project. I’ll be using htmx to handle FE stuff and I’m still discussing with the UX designer (they use Webflow) if we can somehow take htmx into account at design time. MySQL as db (customer’s choice), so let’s see how that stacks up.
- pipeline_peak 2y agoWhat exactly does Go have over C# other than being “sexy” and an emphasis on minimalism? I’ve watched from the sidelines over the years. I hear more people talk about it than use it.
- tail_exchange 2y agoMinimalism is the biggest selling point, if you are comparing it to C#. If you don't see a lot of people using it, maybe you're looking in the wrong place? I work with platforms, and Go is everywhere.
- pipeline_peak 2y agoWhat do you mean by platforms?
- tail_exchange 2y agoPlatform engineering. Think toolchains, devops, cloud, infrastructure...
- bsaul 2y agoi'm at my point in my career (20 years xp) where i think every project should be built around pure functions and structs, sorted in modules. And only once you're sure there absolutely no other choices, add a bit of interfaces, class and inheritance. Which, imho should happen extremely rarely. I've come to realize that the amount of useless abstractions we add just because the language lets us, instead of thinking more deeply about what exactly is the problem we're facing, is just insane.
- metaltyphoon 2y agoYou would probably like this talk by Andrew Kelley https://youtu.be/IroPQ150F6c?si=riT9hL3S2R7KXIWv https://youtu.be/IroPQ150F6c?si=riT9hL3S2R7KXIWv
- mbvisti 2y agoThe author here, thanks for posting this. I can see a lot of people not agreeing with Go, that’s fine, I still love writing it everyday. Taking choices away from you in terms of language features enables you to focus on the problem you’re solving. That makes it a great choice to me.
- honestAbe22 2y agoCan't you just choose to not use a feature?
- tail_exchange 2y agoNo, because I'm not the only person writing code. If someone else chooses to use this feature, I will eventually have to interact with it and/or maintain it.
- p2detar 2y agoThanks for writing this up. > Taking choices away from you in terms of language features enables you to focus on the problem you’re solving. As someone that worked with Kotlin for a couple of years, I can agree with this. I actually enjoyed the language but there were so many, I'd say, obscure things or multiple ways you could do the same thing that I'd feel lost sometimes. As someone once said - Kotlin is easy to write, but somewhat hard to read. In the end I just wanted to solve problems and ship my product and I felt the language was getting in my way a lot of the times. Anyway, in the end I guess it's about personal feeling and conformity with the language of choice.
- mbvisti 2y agoYeah, personal feelings towards a language are a big factor. I once did a short gig with a start-up that used Kotlin and the CTO was very enthusiastic about Kotlin. He showed all the things you could do in the languages like adding behavior to an integer that would be applied throughout the program. He was excited and I was a little horrified haha. But huge companies have been built using Kotlin so who am I to judge? I'm in the same boat as you, I want to solve problems and build products.
- qaq 2y agoIt highly depends on the nature of the project. I like Go, but after prototyping my side project in a bunch of lang. ended up using Python (FastAPI, SQLModel) because it was literally order of magnitude less code than say doing same thing in Go.
- neonsunset 2y agoI bet that just using standard C# and first-party back-end and ORM would have been even less code that works an order of magnitude faster, is easier to deploy and significantly less brittle.
- qaq 2y agoI am sure C# is great not sure about less code part
- ycombinatrix 2y agoBecause it is Java 2.0
- aabbtree77 2y ago"Go is ripe for Web Development" - not really. See youtube videos by Web Dev Cody or Ben Davis who tried Golang in this context and went back to Ts. I would say the major strength of Golang is practical community which tends to avoid elegant complexity. The downside is pointers and the lack of null-safety.