7 ms·
I love Go. It's the new Java, but fewer batteries included, and very easy to learn. I spent a day going over https://gobyexample.com/ https://gobyexample.com/
by ammmir 5y ago
I love Go.
It's the new Java, but fewer batteries included, and very easy to learn. I spent a day going over https://gobyexample.com/ https://gobyexample.com/ and became productive the next day. I tried to do the same with Rust, but I failed. Nobody was able to succinctly explain all the things you have to learn to become productive with Rust, let alone understand anyone else's code, since there are too many different ways of doing the same shit.
I fear generics will make Go go in a worse direction, but I'm not losing sleep over it.
I would even go as far as to say Go is the fastest way to land a $100K/yr job with zero knowledge about programming and still be able to live with yourself (unlike with the JavaScript/npm oligopoly).
Solid Go'ers eschew huge dependencies and prefer classic Unix KISS philosophies. It's a breath of fresh air. And like the performance figures show, your apps magically get slightly faster over the years!
Life is short, use Go.
- chakkepolja 5y agoGo is probably most productive language I'd use for CLI tools and quick server stuff. There are libraries for most things you need, often better documented than python counterparts. Single binary and good tooling. Now, one may hate something about the language but at the end we bite the bullet and get things done. That said, Go doesn't have a great ecosystem for website backend dev. You can do it, but often less convenient.
- asadlionpk 5y agoWhen you say website backend dev. What can be improved?
- maattdd 5y agoTypesafe SQL, typesafe template (or just useful template, not the ones in the stdlib which sucks tremendously), model metaprogramming, etc...
- alecthomas 5y agoFWIW for SQL, sqlc[1] is probably the nicest SQL layer I've used in any language. [1] https://github.com/kyleconroy/sqlc https://github.com/kyleconroy/sqlc
- rawoke083600 5y agoReally, really wanted to use it a few days ago.. but not sure if it's a mysql8 issue but seems most of my "very simple" table definitions couldn't be parsed :/ Looking at the github there seems to a lot of "parsing problems" for the schema files :(
- Cthulhu_ 5y agoDo you have any examples of other languages offering typesafe SQL integrations? Not sure what to think of it, given how you'd end up having to map SQL datatypes (across multiple database engines) with Go's own (not very powerful) types or a custom type validation layer (which already moves the problem to runtime instead of compile-time). I did see a post the other day criticizing Go's standard template language and approach. Maybe someday someone will stand up and build an alternative, more advanced template engine - it can just be a library, after all.
- maattdd 5y agoIn Rust: https://github.com/launchbadge/sqlx https://github.com/launchbadge/sqlx In Haskell: https://hackage.haskell.org/package/esqueleto https://hackage.haskell.org/package/esqueleto Either it analyzes the given SQL to determine the in/out types of each SQL query, or it calls the database describe feature at compile-time.
- Matrixik 5y agoI would love to see some "plug and play" user account management. Like handling registration (with confirmation emails), updating/deleting data, build in handling of changing password to increase complexity over time (or forcing change when some leak happen), some protection from login attacks, account levels (and simple adding new level over time), feature toggles, build in multitenancy (so I don't need to code it later when page grow and need it, something like [1]), using ULID (or something similar) instead simple incremental number for ID, build in login history, some login security features (like email on each login, block account login if someone try login from predefined/differen country and email user about that with unblock/allow access link) and more high level stuff (like account anonymising instead of deleting for reporting). So all the stuff that is good to have when you need it but you don't have time to work on it when you focus on business logic. [1]: https://blog.checklyhq.com/building-a-multi-tenant-saas-data-model/ https://blog.checklyhq.com/building-a-multi-tenant-saas-data...
- oefrha 5y agoCompared to say Rails/Django, there’s very little magic in the Go ecosystem. You end up rewriting a lot of boilerplate. People would often recommend that you start with bare bones net/http, database/sql, etc., not even a minimal framework like Gin/Echo. This is okay for building performant microservices, but it does get annoying when you’re just trying to spin up your twentieth boring CRUD backend quickly.
- kamalhm 5y agoas someone not familiar with Go, always wondering why Go people like to recommend the net/http package instead of those framework, are most go backend services actually written from scratch? I find it quite hard to understand since in the Java world it's usually SpringBoot everywhere
- tompston 5y agoI wrote a REST API / boilerplate reducing codegen tool for this exact reason for the Go Fiber framework. Maybe might help. https://github.com/tompston/gomakeme https://github.com/tompston/gomakeme
- hbogert 5y agoIt really is becoming the path of least resistance. I'm totally not in love with the language itself, though the whole ecosystem -- runtime platform/performance, community, simple multi-arch compilation -- is awesome!
- IshKebab 5y agoI do like Go, but I have to say I rewrote a small (500 line) Go file I'd written into Rust and was constantly thinking "this is better in Rust". And I suspect that Rust performance would have started pretty much where Go 1.18 is now. But I definitely agree that reading other people's Go code is a lot easier than Rust. Especially async code. I don't understand why so many people use async outside of web servers which AFAIK is the only place you really need it.
- quickthrower2 5y agoWeb servers and web browsers, which is a lot of todays dev work.
- IshKebab 5y agoWhy would a web browser need async? It can use threads.
- quickthrower2 5y agoWell nothing needs async, you can use threads anywhere. But it is the predominant model for JS
- IshKebab 5y agoIt's the model in JS because JS does not really support threading (web workers are more like separate processes) so it's the only way to do it. The actual browser doesn't need async. When I say "need" I mean that it provides a decent performance increase.
- Matthias247 5y agonot even necessarily in web servers. If one writes a frontend proxy server which needs to work on > 10k concurrent connections it's likely the way to go. But for an application server which sees much less concurrency it might not matter that much.
- todotask 5y agoI like how Tour of Go includes Generics tutorials is simple to grasp on first reading, wasn't difficult as those have been arguing on golang-nut mailing list before Generics was landed.
- marcus_cemes 5y agoDon't mean to advocate, I've had the opposite experience. I love listening to the guys over at the Go Time podcast, but for simple things I reach for Node (that I desperately want to escape!), and for a better language I reach for Rust, it just feels right, although I completely agree about library code being complex to understand and using a lot of magic to squeeze out every last drop of performance. As a corollary, I still haven't been able to understand Go modules and the way code is supposed to be laid out! In fact, a Go 1.16 broke one of my npm packages as it deprecated `go get` with no real alternative for my use case, without manually creating a go.mod file for the cloned repository (that I don't own) in question. I guess this creates a natural... distate for said language. I think if I would have started with Go, I would have loved it from day 1, but now it provides too much friction to get stuff done. Yeah, it's fast (but most new languages are), it fools C programmers into thinking it's like C due to its syntax, but people coming from the functional world which they believe to be the holy grail will run away in fear with the number of mutations (no Array.map or iterators) and pointers flying around. I still haven't managed to get SQLite working with Go on Windows (stop! a lot of developers do use Windows!), the Rust crate just worked. The only language that I've actually had fun trying out recently is Elixir, which completely surprised me. The AoC challenges were fun to write in it, and honestly still quite fast!
- hnlmorg 5y agoWhat's your issue with SQLite+Go on Windows? I might be able to help
- marcus_cemes 5y agoI just tried it now (a year later), same compiler error (using msys2): # github.com/mattn/go-sqlite3 /usr/lib/gcc/x86_64-pc-msys/10.2.0/../../../../x86_64-pc-msys/bin/ld: cannot find -lmingwex /usr/lib/gcc/x86_64-pc-msys/10.2.0/../../../../x86_64-pc-msys/bin/ld: cannot find -lmingw32 collect2: error: ld returned 1 exit status The go-sqlite3 GitHub repo has tons of Windows-related issues, one just opened yesterday in fact. I'm not an experienced C programmer, I'm not well versed in compiler/linker toolchains, I know it's super tricky (especially on Windows) but I don't expect my clients to be experts either. I actually spent a few hours trying to solve this last time, time I could have spent coding. It's not a problem with Go, per se, but it does create non-trivial requirements toolchain setup on Windows, which ruled out Go for me. The whole toolchain just feels a bit... flakey, setting up GOPATH and such (although, that seems to no longer be the case?). Rust's crates, just as an example, are amazing, I've never had a single problem with them (more than I can say for npm..) I know it's just one example, but sqlite3 is brilliant. This immediately ruled out Go for me for that project.
- zelphirkalt 5y agoWell, if pay is the only thing you want to optimize for and you don't enjoy spending time learning about concepts like Rust's borrow checking and lifetimes ... Sure go ahead. But then don't worry later, when other people have way more knowledge accumulated than you did with the easy-going / not learning much approach. You need to consider, that there are languages, which make use of more advanced or generally less known concepts, and that those concepts take more time than a day to really understand and make use of. Great knowledge and skill is not acquired within a day. It takes time. The "learn in one day" idea sounds more like you only syntax translated previously had knowledge into Go. That enables you to make use of a new ecosystem, which may be great, but it does not enable you to do things in a more intelligent way. You merely switched ecosystems. Life is short, learn interesting things.
- usrbinbash 5y ago> Life is short, learn interesting things. The interesting thing about software engineering to me, is not the features of the languages, its the programs I get to write in them. I don't learn programming languages because I want to know the latest concepts in language design, I learn them so I can write interesting software.
- chrismarlow9 5y agoI agree with you in general that you should be learning interesting things. But I also agree with ammmir about the productivity of Go. I think there (or should be) two worlds of programming in everyones life. There is the business side, where you aim for quick (and quality) output and productivity, and for the business sake, you aim for high development trajectory so that others can work to improve your code. I believe this is why PHP was/is so successful and also why Go is so successful. The documentation is solid, contains real world examples, and the environment is easy to get started in (php example.php, go run main.go). The syntax is also very straight forward and easy to make sense of. And then theres the other world. The things you do outside of business to educate yourself so if the time comes you are prepared. Learning more complex things like Rust, and how ASM works, and the inner workings of the Linux kernel. This is great to learn on your own, and nice to have in your back pocket in the business world if it's required. But for the sake of business growth I think tinkering with these more complex to learn things should be mostly left at home. I guess it really depends on what type of business you want to run (small team with great talent or large team of decent devs), but at the end of the day I want the code I read at work to be so simple that it's almost boring to look at. TL,DR: If you do complex things at work, you'll likely be the one getting calls at midnight about it crashing.
- 62951413 5y agoIn the world where Scala and Kotlin exist "It's the new Java" is not exactly a compliment.