For example, this code:
package main
import "fmt"
func main() {
foo := "bar""
fmt.Println(foo)
}
turns into
package main
import "fmt"
func main() {
foo: = "bar""
fmt.Println(foo)
}
on save. Note the assignment and the double double quotes. This erroneous replacement affects the entire file. I believe it started to happen with the last version or the one before.
Go options enabled:
"go.formatTool": "goreturns"
Same thing happens with gofmt
.
VS Code version 1.25.1, go version go1.10 darwin/amd64.
Any ideas why this happens?
Thanks!
I had the same issue. Check if you have the extension "Visual Studio Code Format", as it was the cause in my case (now working fine since I disabled it). Version 0.0.6 does not seem to be a joke... The rest of the Go extensions seem to be fine.
Note: the side effects of this extension can be disastrous on a big file, since it will reformat every single assignment.