Live data from Hacker News

Twelve Years of Go

go.dev

31–40 of 244 posts

Re: Twelve Years of Go

#31

I cant believe they are moving forward with "generics". Programmers on average already tend to make things more complicated than they should be. Now every single module in the ecosystem is gonna use more abstractions, generics to fit their social environment. Its well known that abstractions are the devil. How many modules are gonna use generics when they should not? Most? Programmers are bad at programming and they…

> Its well known that abstractions are the devil.

Then why are you programming in Go, instead of directly writing x86-64 machine code? Remember that even assembly is an abstraction...

Re: Twelve Years of Go

#32

Earlier quoted context omitted.

since when is if-programming a bad thing

What you learn at school when it comes to programming is to avoid if-statements for control flow. It is error prone. If-statements are mainly used for various types of guards.

vs exception based control flow which is way worse.

Re: Twelve Years of Go

#33

Would you say Go is suitable for web services and apps? I was trying to compare it with a rapid development framework like Rails but felt Go Web Frameworks aren't as mature and ready like Rails. Any insight would be appreciated, thanks!

Definitely suitable. Depends if you want to work within a framework or not.

If you want a framework, use Rails/Django/Node as they are very mature. Huge plugin ecosystems, great for prototyping non-trivial features like authn, because a plugin certainly exists for it.

If you want more control (fewer dependencies), roll everything yourself with Go. The built-in libraries are fantastic, you can spin up a CRUD app without any external libraries. There are also great third-party libraries, but I would stay away from framework-y stuff like GORM.

Re: Twelve Years of Go

#34

Would you say Go is suitable for web services and apps? I was trying to compare it with a rapid development framework like Rails but felt Go Web Frameworks aren't as mature and ready like Rails. Any insight would be appreciated, thanks!

I'd say that's not where its strength lies, but it's certainly possible.

Building an API backend for a single page app though, absolutely.

Re: Twelve Years of Go

#35

Would you say Go is suitable for web services and apps? I was trying to compare it with a rapid development framework like Rails but felt Go Web Frameworks aren't as mature and ready like Rails. Any insight would be appreciated, thanks!

AFAIK nothing has the plug-n-play library availability of Rails, as far as things that are highly relevant to stitching together "web apps". Not even Django, which may be its closest competitor. That single aspect of it is so good that even though I hate Rails (but I think Ruby's alright—go figure) it's hard to recommend against it for some projects.

Re: Twelve Years of Go

#37

12 years and still no proper error handling. World stars. ;) Seriously, the error handling is a big problem with Go. Not the way it works, the way it effects how people do control flow in general.

Error handling is easily one of my favorite things about Go. No 'oops I forgot to put in a try/catch and now my code died with no explanation'. No 'I forgot a finally ( or didn't realize I needed one ) and now I'm leaking resources'. No 'should I return Null or false or an error code?'. No '20 log messages for the same error because every function is reporting it'. The Go model - Return err, always as the last parame…

1. You have something that catches and logs all uncaught exceptions.

2. Defer is nice. As easy to forget as using in C#.

3. Always null/nil. Uncle Bob is plain wrong here.

4. Stack trace. But you should keep things wide and shallow. No matter what technology you use.

In Go it is about as easy to swallow errors as with try-catch. But my post was more about how all the if-statements generates more unnecessary if-statements.

Re: Twelve Years of Go

#38

Earlier quoted context omitted.

since when is if-programming a bad thing

What you learn at school when it comes to programming is to avoid if-statements for control flow. It is error prone. If-statements are mainly used for various types of guards.

'if' is the epitome of control flow (next to looping). It's fundamental to computer programming. It's honest. Don't be ashamed of control flow, don't hide your control flow as if it didn't exist.

Re: Twelve Years of Go

#39
post #9

I’ve only picked up Go recently and I must say that the beginner experience is superb. Way easier to get started, learn new concepts and put them in use compared to some other languages.

can you recommend any video lectures?

Re: Twelve Years of Go

#40

Would you say Go is suitable for web services and apps? I was trying to compare it with a rapid development framework like Rails but felt Go Web Frameworks aren't as mature and ready like Rails. Any insight would be appreciated, thanks!

AFAIK nothing has the plug-n-play library availability of Rails, as far as things that are highly relevant to stitching together "web apps". Not even Django, which may be its closest competitor. That single aspect of it is so good that even though I hate Rails (but I think Ruby's alright—go figure) it's hard to recommend against it for some projects.

True, but that's comparing a (light) framework to a language itself.

Go is great for web services, it's the first thing I reach for.

Post reply on HN