4 ms·
One area where Go has quickly established a niche is in tooling, for example Terraform. Here the benefits of being able to run a single (non-containerised) bina
by tragomaskhalos 4y ago
One area where Go has quickly established a niche is in tooling, for example Terraform. Here the benefits of being able to run a single (non-containerised) binary vs having to fret about what version of Java your punters happen to have installed in compelling no?
- jpgvm 4y agoYeah that is fair. By and large such tools remain smaller codebases so it's flaws aren't as apparent either. My personal preference for such tools is Rust but it's admittedly a harder sell. Comment above is mostly addressing the server software use case with larger teams and 100KLOC+ (either one or many programs). I don't think anyone was using Java much in the CLI niche. It was dominated mostly by Python and Ruby (and Perl before that) before Go came along. I do think Go represents an improvement on that status quo.
- sofixa 4y ago> By and large such tools remain smaller codebase so it's flaws aren't as apparent either. Kubernetes, Docker, Terraform and their respective ecosystems really aren't what one would call a smaller codebase.
- jpgvm 4y agoHence the "by and large" qualifier. There are certainly exceptions.
- thayne 4y agoI often wish terraform wasn't written in go. Usually while making a patch to it, or reading the source code. Though not as much as I wish that terraform had used an existing "real" programming language rather than creating HCL.
- sofixa 4y agoTerraform not written in Go wouldn't have existed. If it relied on a JVM or Python/Ruby interpreter being present, at the correct version, it never would have gotten as popular, and if it were statistically compiled C/C++ it would have never gotten as far and as quickly. Go offers a nice balance between performance and platform agnosticism, features like parallelism without it being too complex to write. Manual memory management would have been a useless obstacle wasting developer time for little real gain. Fighting the language to have parallel execution, easy crosscompile, etc. why? As for HCL, I'm on the opinion that a DSL is better. It's even in the name, Infra as Code, not with code. You want your infrastructure declarations to be easily readable and supportable. Anyone who has used Terraform can read any HCL; your Python code doing the same could be terrible and unreadable by anyone not already on your team. Too much flexibility for something as critical can end badly, imho. In any case, there's cdktf now, you can mix and match terraform with cdktf. Disclaimer: I work at Hashicorp, opinions my own and have stayed the same since before joining
- azth 4y ago> If it relied on a JVM or Python/Ruby interpreter being present, at the correct version, it never would have gotten as popular, As far as I know, it's not hard to ship a JVM runner with the installer of your program, so this should be a non-issue.
- thayne 4y agoAnd using a "virtual environment" with a specific version of the interpreter is a common workflow for python, and sometimes ruby
- jpgvm 4y agoYeah but Ruby and Python aren't relocatable so it's hard to ship a self-contained interpreter with the program itself. This is due to their reliance on system paths among other things. You can trivially ship a self-contained JVM that is completely isolated within a single directory.
- 4y ago
- tragomaskhalos 4y agoSorry yes you were talking about transitioning from an existing Java situation and you're right, for the spaces that Java typically operates in I don't imagine there is much advantage in considering a switch to Go; it's as much an ecosystem factor as anything, the Java world has had a long time to mature, and while I dislike many aspects of it (assemblages of classes communicating in spooky hard-to-grok ways via oodles of config) it is at least battle-hardened.
- jpgvm 4y agoTo address your last point I think that style of Java has fallen out of favour in recent years. It's still around, there is a lot of existing J2EE codebases but it's successor - Quarkus has done away with the vast majority of the config mess. I can't speak to how well it manages that transition though as I was never a big J2EE guy. The other old offender, Spring, developed a new convention over configuration distribution called Spring Boot which requires minimal configuration and has pretty much displaced the old way of doing things entirely. It's been around for years as the default option at this point. The way I see Java is that it moves slowly but tends to happily assimilate the best ideas from other languages, runtimes and frameworks and over time sheds it's warts (Java 8 era sun.internal.*, old Date/Time APIs, etc). Not everyone seems to have an up to date opinion of Java because the last time they touched it was J2EE days or worse yet in university.
- Groxx 4y agoI'm not fond of Go, but yeah - it has completely replaced Python for my command-line-tool building and I'm much happier with it. It's almost enjoyable for that. A lot of things about Go work out well in practice when there's a human watching it that can just slaughter the process if it starts going off the rails, and the trivial distribution and excellent startup performance make it almost perfect for CLIs. Small code works fairly well, and the sometimes-quite-yolo stdlib gets you to "works on my machine" for 99% of your needs quickly and that's often good enough for ad-hoc tooling (and when it isn't: just delete that non-UTF-8-named file, sheesh). For large stuff? No please. The type system is far too weak, and the runtime has too many sharp corners. About the only thing I like about it for this is that runtime reflection is very tightly restricted, which prevents some of the worst insanity you see in Java.