10 ms·
As a developer I continue to be extremely happy with the Go language and the Go tools. Over the past 5 years Go has almost entirely replaced my use of C and C++
by 37ef_ced3 5y ago
As a developer I continue to be extremely happy with the Go language and the Go tools. Over the past 5 years Go has almost entirely replaced my use of C and C++. My Go programs (e.g., https://NN-512.com https://NN-512.com) are reliable, run fast, build fast, require no shared libraries, and have airtight error handling. Unfortunately, C++ is still necessary for my commercial work and I am amused daily by the absurd complexity and clumsiness of expression, slow builds, dynamic linkage problems across Linux releases, etc.
- pizza234 5y ago> require no shared libraries One amusing downside: the Golang hello world binary takes 2 MB; when compiled with gcc though (against libgo, therefore, dynamically linked), it takes an astonishing 60 KB - not even 64 KB!
- brokencode 5y agoFor some applications this matters, but for a typical web server or web architecture, which is what go is optimized for, rarely if ever would a couple MB of binary size make a difference.
- taywrobel 5y agoEspecially when tossed in a container for most workloads nowadays. You can have a full go binary statically linked and copied into a FROM SCRATCH docker image and it just works, and is miniscule. For example, that's all that the production image of NATS Streaming is - https://github.com/nats-io/nats-streaming-docker/blob/024b04f6c0d4658cf5751b21b48555bbe9280be5/0.22.0/scratch/Dockerfile https://github.com/nats-io/nats-streaming-docker/blob/024b04...
- foobiekr 5y ago... and then someone puts it in a container, probably sourced without any kind of tracking, and blows cross-app shared library page sharing and adds tons of other on-media bloat. It's so crazy where we are.
- bitwize 5y agoRAM and storage are cheap. Their cost is a mere pittance for the benefits of containerization. It's like when people whinge about Electron. Electron gets you a runtime that's near identical across the major platforms, with a11y (something the Linux native toolkits still don't have their shit together on) essentially for free, plus you can use modern reactive component frameworks like React and Vue on the desktop. Yeah, I'll pay 300 MiB for that.
- kaba0 5y agoI highly doubt that the optimal GUI development is at “modern reactive comp frameworks”, when decade old desktop frameworks had better tooling than that.
- EvilEy3 5y agoI seriously doubt that. Mobile platforms and web would be moving towards "decade old desktop frameworks" if those were superior.
- kaba0 5y agoMobile platforms are most definitely not web technology, they are much closer to desktop frameworks. And the only reason the web is not doing so is (was) due to backwards compatibility and HTML being a bad target. But with WASM and canvas-based renderers, desktop frameworks sort of make an appearance on the web (though I personally dislike the canvas-oriented design, which basically throws away every accessibility)
- pjmlp 5y agoI find it more ironic when monolithic kernels are argued for and then get placed in layers of abstraction to achieve what microkernels offer out of the box.
- simias 5y agoThat used to bother me with Rust as well, but frankly nowadays it's really hard to argue against it. Even in the embedded world you typically have enough flash these days that you're not counting a couple MBs, and as far as RAM is concerned you'd only save some memory if several binaries run simultaneously while linking to the same shared libs. And even then it's not a sure win, because LTO can remove a lot of useless code from dependencies, so if you only use a small part of a dependency you might still be better off with static linking regardless of other factors. It's pretty hard to justify the complexity and overhead of dynamic linking nowadays, IMO.
- pjmlp 5y agoDepends, dynamic linking is great for plugins, on the other hand I guess we have learnt that IPC is a better option for security and overall application stability.
- anderskaseorg 5y agoAlthough it used to be worse, these days a standard Rust “Hello, world!” compiles to just 277 KB on Linux with ‘cargo build --release’ and ‘strip’—5× smaller than the equivalent for Go (and there are games you can play to get it down further).
- simias 5y agoOh, that's very cool, I hadn't checked that in ages. Any idea on what Rust does better here? Better link time optimization? Or is the Go runtime just that heavier?
- colin_mccabe 5y agoRust doesn't really have a "runtime" in the same sense that Go does. For example, Rust has no GC.
- sitzkrieg 5y agonot counting MBs!? must be nice, havent developed on something with 1MB or more in years
- slx26 5y agoNo one is actively happy about it, but when you account for garbage collection and other runtime stuff that goes into a regular go program, plus no dynamic linking... you have to be happy with the trade-off. It's the right one for most programs we will ever make.
- throwaway894345 5y ago> It's the right one for most programs we will ever make. Unless you’re in the lucrative hello world industry. Or at least I assume it’s lucrative since so many people come here posting about hello world binary sizes—it certainly seems to employ a lot of people.
- deleted 5y ago[deleted]
- herpderperator 5y agoIf you wanted to, couldn't you just compile your C/C++ program statically and then it would be comparable to a Go binary?
- 37ef_ced3 5y agoAs is true of many developers, I am part of a large team working inside an ecosystem of enormous C++ programs. These programs are written in a particular way (heavily templated) and built in a particular way (dynamic linkage, CMake) and it's neither feasible nor wise to change these foundations
- herpderperator 5y agoI guess the point I am trying to make is if you had chosen to be statically-linked from the start, then it would be comparable to a Go binary of today. If Go had many dynamic dependencies and people became "stuck" with them, and Go later introduced statically-linked binaries, then it would be the same as your C/C++ example, wouldn't it? In other words, it's not a distinguishing factor because you can be fully statically-linked in C/C++ if starting today with a new project with that goal in mind.
- 37ef_ced3 5y agoSure. But here we have a typical situation where the Go tools get it right by default, and of course a sophisticated engineer can achieve the same effect with non-Go tools even though those tools get it wrong by default
- deleted 5y ago[deleted]
- jsjsbdkj 5y agoGo is mostly very good, but the module ecosystem continues to be a nightmare, and having a deep dependency graph can make build times brutal. I work on a project which depends on k8s, which means a cold build take several minutes. Not to mention trying to update dependencies and figure out what versions are actually being built into the final binary.
- 37ef_ced3 5y agoAnyone who works on large C++ projects will laugh at your "several minutes" comment. You may not realize how bad things are on the other side of the fence
- beforeolives 5y agoWho is doing dependencies right in your opinion? Because it feels like it's a complaint I hear about every language.
- coolreader18 5y agoMight be biased/stereotypical, but Rust's cargo does dependencies really well. It's as easy as npm to add new dependencies, but there aren't thousands needed to do anything, and if you take a look at your Cargo.lock/`cargo tree` you can really get to know each of them and what they do or why they're pulled in. I'm still bloat-wary, maybe as a leftover from doing webdev, but with less transitive dependencies in the first place you can actually go through and prune things that aren't needed, or open PRs to transitive deps to prune from their trees or update deps to the latest version to deduplicate your tree. (If there are multiple semver-incompatible versions in a dep tree, they just both get compiled in - for most apps though, you should be able to get the number of duplicates to 0 or almost that.)
- rejectedandsad 5y agoCalling out again, this is a fantastic program and it's remarkable that this is released pseudonymously (for whatever reason)
- 37ef_ced3 5y agoThanks man
- bitcharmer 5y agoFor me the major remaining issue is a golang ide, or lack thereof. You only have 3 options: - Goland from Jetbrains; awesome but costly - Vscode with golang plugin; slow, brittle, little functionality -vim; yuck It'd help adoption greatly if there was a decent free option here.
- ulzeraj 5y agoI love vim. =( Its there everywhere you need it. If I have to use these other fancy pants editors I always enable vim emulation when possible but its never the same.
- gigatexal 5y agoYeah vim plus govim amazing.
- haolez 5y agoOne of Go's creator did a lot of the initial coding in Acme[0] :D [0] https://en.wikipedia.org/wiki/Acme_(text_editor) https://en.wikipedia.org/wiki/Acme_(text_editor)
- ainar-g 5y agoSomething tells me that a person who reacts to Vim with a “yuck!” won't like Acme either. Also, I don't know how true this is, but I've read that Acme loses some of its advantages when it's run in e.g. X11 as opposed to its native rio[1] with plumber[2]. [1]: https://en.wikipedia.org/wiki/Rio_(windowing_system) https://en.wikipedia.org/wiki/Rio_(windowing_system) [2]: https://9fans.github.io/plan9port/man/man4/plumber.html https://9fans.github.io/plan9port/man/man4/plumber.html
- haolez 5y agoI _think_ that Rob used Acme in OSX, but I can't find this source.
- libria 5y agoOff topic: this NN-512 site has good UX for having no CSS/JS (I know, many of you would claim it's because those are omitted...). Did you use some kind of site generator?
- 37ef_ced3 5y agoThe program generates the HTML for its own website (in DRAM) and serves that HTML over HTTPS. When you access that webpage, you are communicating with an NN-512 process that is running on a $5/month Linode cloud instance
- libria 5y agoOk ok I see it in e.g., https://nn-512.com/browse/NN-512#64 https://nn-512.com/browse/NN-512#64. The anchor tags for the listings go to top instead of being self-referencing. Is that a bug? Like format = `<h3 id="%d"><a href="#0">%s</a></h3>` + Should be format = `<h3 id="%d"><a href="#%d">%s</a></h3>` + And Fprintf should duplicate a parameter?
- 37ef_ced3 5y agoNo, that's intended. There's an index at the top of each page. You use the index links to jump down. And if you want to jump back up to the index, you use any of the header links. That makes sense to me. It seems useless for a link to point to itself
- libria 5y ago> It seems useless for a link to point to itself Hm. I guess the web has programmed me differently. Say I'm CTRL-F searching through the page and I notice an interesting bit of code and say "Hey I have a question about this". Then I start looking for a shortcut to that one file and assume that shortcut is the nearby <h3> header. I expect this because I've seen this pattern implemented a lot. You could have the <h3> be that local anchor and a short [top] link next to it.