Remix.run Logo
tayo42 3 days ago

Surprised you made it more compact and not have it turn into 40k lines of if err! = nil

Ive done do rewrites of stuff in python and it gets really verbose, plus dependency injection patterns for testing.

benjiro 2 days ago | parent [-]

A ton of stuff in PHP is mostly templating + DB calls for a lot of websites.

If you combine Go + Templ for instance, your "if err" are mostly on the DB calls. What you needed to check in PHP anyway.

Yes, the if err != nil is extreme frustration when your doing for instance, type conversion. But if your already doing this with reflection in your DB calls (by casting to the correct types in your struct), that saves a ton.

Same with getting external data, casting it directly to structs and if something is wrong, its a single "if err".

And if your just doing PHP style programming in Go, well, _, ignoring errors like PHP does and you can panic/recover to make Go act as badly as PHP, to save on the "if err". ;-)