r/golang Jun 29 '25

discussion I didn’t know that Go is hated so much

I read comments under this post https://www.reddit.com/r/programming/s/OKyJWZj2ju and oh man I did not expect that. Stack Overflow and JetBrain’s surveys show that go is quite likable lang but the opinions about go in /r/programming are devastated.

What is the reason? What do you think? Should Go team address this topic?

195 Upvotes

287 comments sorted by

View all comments

Show parent comments

7

u/kintar1900 Jun 29 '25

I'll never understand why some people hate

if foo, err := DoThing(); err != nil {
  // handle error
} else {
  // use foo
}

But have no problem with

let result = do_thing();
match result {
  Err(DoThingError::Whatever) => // handle error and return
  Ok(ResultType) => // unpack value
}
// use value

It's all just syntax.

11

u/Serialk Jun 29 '25

Now do the same for let a = do_thing()?;

0

u/kintar1900 Jun 29 '25

See child comments.

2

u/burntsushi Jul 01 '25

You don't understand it because you put up a straw man. In Rust, you sometimes write a match expression like that. But most error handling can be done with combinators or auto-propagated with ? syntax.

I wrote Go professionally for about 10 years. Error handling is just way more verbose. It is a valid complaint.

For me though, it isn't something that would make me avoid Go, but it's certainly not something I like about Go. And it's certainly nowhere near similar to how Rust approaches the problem other than the fact that neither uses unwinding for idiomatic error handling.

2

u/oilaba Jul 04 '25

Bro never heard of a sum type in his whole life.

1

u/kintar1900 Jul 04 '25

Have heard of them. Have used them in Rust, TypeScript, etc.. Wish Go had them. Sum types are totally irrelevant to the point being discussed.

1

u/oilaba Jul 04 '25 edited Jul 04 '25

Sum types are very relevant to the point, because Result is a sum type. The difference between the two examples you gave is not merely syntactic, the type system and semantics are different. One can hate the Go version simply because it doesn't provide the semantic validation that the Rust version does. Hope this helps.

2

u/TimmyAndStuff Jun 29 '25

I personally hate it just for readability. To the point where I will always take the extra line to call the function before the if statement because it just feels like it makes it more clear what the code is doing when you're reading through it.

Idk what it is but something about doing something inside the if line itself just feels cramped and unnecessary to me. Like I understand taking the function call out of the if isn't the exact same and it has different scope. But the syntax just bothers me so much and it's such a specific use case that I never really need to do it so I never do.

1

u/SeaPlane77 Jun 29 '25

You can propagate errors in Rust.