Earlier quoted context omitted.
You don't even need CGo or unsafe to deal without a GC. Go's GC is written in Go and it obviously doesn't depend on a GC! You just need to know which features imply a GC/allocation and you need to take care to avoid those features. Conceivably, you could devise a linter that statically verifies your no-GC requirement.
> You just need to know which features imply a GC/allocation and you need to take care to avoid those features. This is very insightful. Would you mind sharing more resources regarding that? I'd be interested in a list of such features. The GC can also be used manually by setting GOGC=off, then be triggered manually at the most convenient time.
Thirteen Years of Go
161–170 of 217 posts
Re: Thirteen Years of Go
#162Earlier quoted context omitted.
Not sure if it’s an exact parallel, but you can also embed files into rust binaries with “include_bytes!” and “include_str!”.
It's a bit more advanced than what Rust macros provided last time I checked. You can shove whole directories in there and then traverse them or serve as static resources with pretty much one line of code. Random blog post with a few examples: https://blog.carlmjohnson.net/post/2021/how-to-use-go-embed/
Re: Thirteen Years of Go
#163Earlier quoted context omitted.
I keep count in my own code of the number of bugs Go's "damnable use requirement" has caught for me, and I'm now up to 5. It's not a big number, but they were real bugs that would have annoyed the shit out of me if they'd made it into shipping code. I think this is one of the polarizing decisions Go made that is going to turn out to be universal orthodoxy 10 years from now. I think error handling is the thing about G…
> I keep count in my own code of the number of bugs Go's "damnable use requirement" has caught for me, and I'm now up to 5. Are you saying that you’ve had 5 bugs caused by unnecessary imports ?
Re: Thirteen Years of Go
#164Earlier quoted context omitted.
Not sure if it’s an exact parallel, but you can also embed files into rust binaries with “include_bytes!” and “include_str!”.
It's a bit more advanced than what Rust macros provided last time I checked. You can shove whole directories in there and then traverse them or serve as static resources with pretty much one line of code. Random blog post with a few examples: https://blog.carlmjohnson.net/post/2021/how-to-use-go-embed/
Re: Thirteen Years of Go
#165Earlier quoted context omitted.
Personally, I hate writing Go. It's a very dull and boring language, but it's an amazing language (objectively speaking) for software development. 1) It's performant. The language itself is very fast, the GC is very fast and go routines make concurrency fast. 2) The tooling is great. Once you have the Go CLI installed, everything else "just works." Cross-compilation is super easy. Install dependencies is easy. Genera…
Not sure generics are amazing. I wish I could do something like addresses := persons.map(func(p Person) Address {p.address}) Actually what I really want is addresses := persons.map(p => p.address) But I understand Go doesn't allow that level of readability.
Say you have a list of classes and want to pull out certain fields. With immutability as default and easy map functions many people write something like this:
a = my list.map(e => e.foo)
b = mylist.map(e => e.bar)
This may or may not matter performance wise but I think Go has a strong culture of of making something like this easy vs writing a for loop that does everything in one go.
Re: Thirteen Years of Go
#166Anyone else feeling put off by golang? The syntax, the crazy error handling, etc. To me it's like taking a step back in programming, or actually 20 years back. Not better than Java (which is annoyingly verbose), maybe better than Pascal.
Re: Thirteen Years of Go
#167I've enjoyed writing Go for years. However, it's not been the language that does it for me. It's been the combination of features and ecosystem that makes it a default. It's hard to explain, but the language is one you can throw into a team of random developers and come out with benchmarks, tests, CI/CD pipelines, unified code formatting, and good parallel work models (via goroutines) almost every time. Builds are in…
Why even perpetuate this red herring comparison—maybe over a decade old?—by making unprompted mentions of Rust though.
Re: Thirteen Years of Go
#168Anyone else feeling put off by golang? The syntax, the crazy error handling, etc. To me it's like taking a step back in programming, or actually 20 years back. Not better than Java (which is annoyingly verbose), maybe better than Pascal.
I don't like Go personally, but I have advocated for Go to be used in many situations depending on context. It's unproductive to start a language war here since it's generally situation-dependent.
Re: Thirteen Years of Go
#169Earlier quoted context omitted.
"Errors always get handled because the linter points them out and the devs don't cheat by setting up multi-function try/catch blocks" My experience with Go has been that errors get "handled" by propagating them up the stack manually and then logging them, without keeping proper track of how the error got there. So there is error handling but only in theory, in practice what you get is a sort of hand-written stack unw…
In go, you either handle the error where it happens or close to it, or log it. No need to pass things up just to log. I like the simplicity, and the zero cost at runtime. If you could handle the error in another lang you could handle it in go, or youd just supress or log it anyway.
Re: Thirteen Years of Go
#170Earlier quoted context omitted.
I currently write a SaaS website in Go after doing quite some Rust. I do prefer Rust as a language - it's more expresive and I greatly prefer Result over error, but it has two major downsides for me compared to Go. First compilation is much slower and Go feels like a non-compiled language because of the compilation speed (my last startup I've used Scala with horrendous compilation speeds, the main reason not to use i…
Not sure if it’s an exact parallel, but you can also embed files into rust binaries with “include_bytes!” and “include_str!”.