loading...

Discussion on: Why learn... a statically typed language?

Collapse
biros profile image
Boris Jamot ✊ /

Thanks for this interesting article!

I just switched from PHP to Golang and I must admit that I feel a lot better now. In PHP, I used many linters and unit tests to ensure the quality of my code whereas in Go it's just built-in.

The developer experience is also incredibly better as IDEs can detect errors even before the compilation, without any third-party tools. The code is also easier to browse.

The only drawback is the compilation step, but in a language like Go, compilation is so fast that you can even just use go run ./... without any perceptible overhead.

Collapse
gypsydave5 profile image
David Wickes Author

Thanks for the feedback Boris - yes, Go really is a lot of fun, isn't it?

Collapse
biros profile image
Boris Jamot ✊ /

I wouldn't say that. It better suits my developer experience but there are still some "pin in the ass" behaviors.

Collapse
rhymes profile image
rhymes

In PHP, I used many linters and unit tests to ensure the quality of my code whereas in Go it's just built-in.

That's a bit of a trap, you should still write tests, but you don't need to guard against types most of the time, that's for sure. Go still has the interface{} escape route so you might have to do some type checking at runtime once in a while.

You can setup linters as well, with golangci-lint for example.

Collapse
biros profile image
Boris Jamot ✊ /

When I said that the tools are built-in, I meant it's part of the SDK. I was not saying it's automatic or whatever. 😊

Collapse
bwhitelaw24 profile image
Ben W

what are the advantages of using golangci-lint over go lint and go vet?

Thread Thread
rhymes profile image
rhymes

They are both included in golangci-lint. It packs multiple linters for different aspects, check out the Readme in the link