4 ms·
most of these seems reasonable, but they are not big enough for me to actively dislike the language. The capitalisation is maybe the most annoying for me, I th
by lkramer 7y ago
most of these seems reasonable, but they are not big enough for me to actively dislike the language.
The capitalisation is maybe the most annoying for me, I think it was designed with an IDE in mind (which would be able to automatic update all references), but I still find it a flawed design to have to touch potentially a lot of files, many places to change something from private to not private.
The problem with err has also bit me a few times. I don't like exceptions very much, but a solution like he suggests where a variable can only be ignore explicitly would solve it.
Go is not perfect, but for me there is nothing else better for microservices that I have come across.
- _bxg1 7y ago> where a variable can only be ignore explicitly Like Rust :)
- lkramer 7y agoI keep meaning to check it out :)
- _bxg1 7y agoI'm still pretty new to it and I've never used Go, but Rust seems to address most if not all of these problems, while serving many of the same original design goals of Go. Probably its biggest disadvantage is the learning curve/iteration speed: it doesn't make it easy to just hack things together, especially when you're first learning.
- weberc2 7y agoYeah, iteration speed is a pretty big blocker for adoption in a lot of domains. Go isn’t perfect, but it lets me get things done today. That said, I appreciate that Rust exists for safety/performance critical domains, and as Rust matures (e.g., as it’s async story solidifies and consensus emerges around various HTTP libraries, etc), it will be more competitive for general purpose application development. But I suspect there will always be a significant productivity gap.
- _bxg1 7y agoI suspect that once I've better-internalized the borrowing mechanisms I'll be able to move at a reasonable clip in Rust. The build/package management environment is pretty batteries-included and "just works", and the syntax isn't particularly verbose, just strict. Once getting things to compile is no longer a debugging process for me personally, I don't really see any other intrinsic bottlenecks.
- fwip 7y agoIf you don't want to use an IDE to rename, consider the excellent `gorename` tool. It is integrated with plugins for most editors (vim, vscode and atom off the top of my head), or is easy to invoke from the command line. Golint can enforce the "don't ignore errors" rule. I think it comes that way out of the box?
- vorg 7y ago> The capitalisation is maybe the most annoying for me, I think it was designed with an IDE in mind If you don't have an IDE, you can start by making all functions and methods private. When you know you need it public, wrap the private function with the public one: func myF(ana int) { /*do something */ } func MyF(ana int) { myF(ana) } The same trick is often used for adding extra parameters to a function, except that the function body must be moved: func myG(a int) { myG2(a, 7) } func myG2(a, b int) { /*do something*/ } Adding publicness to a function is like adding an extra parameter to it.
- nhooyr 7y agoYou can just use gorename. https://godoc.org/golang.org/x/tools/cmd/gorename https://godoc.org/golang.org/x/tools/cmd/gorename