I like having a little visual separation of the type names from the variables in Go. I've been playing with the following:
var target (int64) = 600851475143
var largest (int64) = 0
var i (int64)
So far it compiles correctly and I don't see any difference in the result of my program run.
Is this dangerous? Is there any semantic difference between the above and the below?
var target int64 = 600851475143
var largest int64 = 0
var i int64
Thanks
There is no semantic difference but you may find yourself fighting against go fmt
so I'm thinking it's not worth it.
You don't code alone.
Even if nobody else ever reads your code, you'll read the code of others : the one of the standard API, the one of the components you'll use, and the one of the blogs, SO answers and all documentations.
The standardization of formatting brought by go and enforced by gofmt
ensures you read all go code easily, without having to get used to the formatting style of the writer. In a code simply formatted, a lot of errors are naturally avoided as what isn't usual is immediately seen.
Besides, here's like your not parenthesis enhanced code look like in a standard editor :
No need to add something to let the types be visible.
I suggest you run gofmt on all your code and read the standard packages code in order to try to have the same formatting style (including for the comments).
Here's what Rob Pike had to say about code and comment decoration. I think those are good advices even if not everything apply to go.