I couldn’t care less about crashes, that’s an end-user problem. But do you expect me to go to sleep while that squiggly line in my IDE??
/s just in case
Step 1: Remove the LSP from IDE.mod
Step 2: Run
go mod tidy
I mean it isn’t even just a squiggly line, the code fails to compile. Like come on, I will clean up my unused imports and variables before sending it for review, but just let me develop in peace.
You’ll
go fmt
and you’ll like it. Go has the single easiest to Google name of any programming language. Thou shalt not question golang decisions.Go has the single easiest to Google name of any programming language.
Ackchually
C is also bad - but I do think .Net takes the cake. I’m willing to give C a pass though since it existed before we had search engines… Go was specifically developed at Google so there’s no excuse.
it’s like half the number of keystrokes
Ah yes. The good old
go figure --it out
You bring back my bad memories of having to implement a server program in rust and all my searches ended up with about 1/3 useful results and the rest being hosting options for rust gameservers
gofumpt’s even beter, also golaegci-lint-langserver
panic();
As a use-rust-for-even-the-most-basic-task elitist, I laugh.
You laugh in 16 GB to compile rust-to-bytecode compiler
Me (Chad): having to get 32GB+ of RAM to compile my memory-safe point-and-click adventure
You(virgin): being able to compile your segmentation faults with 4GB RAM
Giga Chad: having to get 32GB+ of RAM to compile rust-safe memory-leaks
Tera Chad: having to get 32GB+ of RAM to compile bus faults
Imagine getting segmentation faults at runtime
This post was brought to you by the Rust crew
Neither does Haskell, and Haskell won’t waste time doing something that doesn’t matter.
Here you are https://pkg.go.dev/github.com/samber/mo
Thank you very much, I’m definitely going to take this for a spin! Can I ask if you or someone you know uses this? I’m curious what the experience is like and if theres any downfalls.
A simple example:
func GetConfig(path string) mo.Result[*Config] { return mo.Try(func (*Config, error) { // logic to get the config }) } conf := GetConfig.OrElse(&DefaultConfig)
While it might not make much sense for a function you use just once, it can get actually pretty useful to simplify error handling like this for something you use more often.
mostly the
Result
type.MustGet
where you’d except a panicOrElse
to pass a fallback value (can be a function with return value of the same type, as the inner function, but without an error). Useful in e.g. more complex constructors where some fields might not be readily available.Either
can for instance be useful to have arbitrary type unions in structs. I haven’t usedOption
that much but seems similar to Rust’s.
deleted by creator
Panik !!
It’s not easy to discover that you passed an empty memory pointer.
deleted by creator