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.
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.
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.Thanks for the feedback Boris - yes, Go really is a lot of fun, isn't it?
I wouldn't say that. It better suits my developer experience but there are still some "pin in the ass" behaviors.
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.
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. 😊
what are the advantages of using golangci-lint over go lint and go vet?
They are both included in golangci-lint. It packs multiple linters for different aspects, check out the Readme in the link