Repository: go
Issue: x/tools/gopls: source.fixAll codeaction corrupts source
Labels: gopls,Tools,gopls/corruption

VSCode 1.55.2
VSCode Go 0.24.2
gopls 0.6.10 and 0.6.11-pre.1

settings.json:
```
    "[go]": {
        "editor.codeActionsOnSave": {
            "source.organizeImports": false,
            "source.fixAll": true
        },
    },
```

main.go:
```
package main

type astruct struct {
	A int
	B int
}

type bstruct struct {
	a astruct
}

type cstruct struct {
	pb *bstruct
	sa []*astruct
}

func main() {
	c1 := cstruct{&bstruct{astruct{1, 2}}, []*astruct{{1, 2}, &astruct{2, 3}, &astruct{4, 5}}}
	_ = c1
}
```

Trigger file save, and observe how the line `c1 := ...` that had multiple lint issues changed.

```
func main() {
	c1 := cstruct{&bstruct{astruct{1, 2}}, []*astruct{{1, 2}, {2, 3}, &astruct
	_ = c1
}
```

gopls trace (gopls v0.6.11-pre.1):
```
[Trace - 10:59:24.347 AM] Sending request 'textDocument/codeAction - (8)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/demo/tools.go"},"range":{"start":{"line":0,"character":0},"end":{"line":20,"character":0}},"context":{"diagnostics":[{"range":{"start":{"line":18,"character":3},"end":{"line":18,"character":7}},"message":"expected '==', found '=' (compile)","severity":2,"source":"go-staticcheck"},{"range":{"start":{"line":19,"character":1},"end":{"line":19,"character":1}},"message":"missing ',' before newline in composite literal (compile)","severity":2,"source":"go-staticcheck"},{"range":{"start":{"line":17,"character":59},"end":{"line":17,"character":67}},"message":"redundant type from array, slice, or map composite literal","severity":2,"tags":[1],"source":"simplifycompositelit"},{"range":{"start":{"line":17,"character":75},"end":{"line":17,"character":83}},"message":"redundant type from array, slice, or map composite literal","severity":2,"tags":[1],"source":"simplifycompositelit"}],"only":["source.fixAll"]}}


[Trace - 10:59:24.348 AM] Received response 'textDocument/codeAction - (8)' in 0ms.
Result: [{"title":"Remove '\u0026astruct'","kind":"source.fixAll","diagnostics":[{"range":{"start":{"line":17,"character":59},"end":{"line":17,"character":67}},"severity":2,"source":"simplifycompositelit","message":"redundant type from array, slice, or map composite literal","tags":[1]}],"edit":{"documentChanges":[{"textDocument":{"version":35,"uri":"file:///Users/hakim/demo/tools.go"},"edits":[{"range":{"start":{"line":17,"character":59},"end":{"line":17,"character":67}},"newText":""}]}]}},{"title":"Remove '\u0026astruct'","kind":"source.fixAll","diagnostics":[{"range":{"start":{"line":17,"character":75},"end":{"line":17,"character":83}},"severity":2,"source":"simplifycompositelit","message":"redundant type from array, slice, or map composite literal","tags":[1]}],"edit":{"documentChanges":[{"textDocument":{"version":35,"uri":"file:///Users/hakim/demo/tools.go"},"edits":[{"range":{"start":{"line":17,"character":75},"end":{"line":17,"character":83}},"newText":""}]}]}}]


[Trace - 10:59:24.354 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"uri":"file:///Users/hakim/demo/tools.go","version":36},"contentChanges":[{"range":{"start":{"line":17,"character":59},"end":{"line":17,"character":67}},"rangeLength":8,"text":""}]}


[Trace - 10:59:24.357 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/hakim/demo/tools.go","version":36,"diagnostics":[{"range":{"start":{"line":17,"character":67},"end":{"line":17,"character":75}},"severity":2,"source":"simplifycompositelit","message":"redundant type from array, slice, or map composite literal","tags":[1]}]}


[Trace - 10:59:24.358 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"uri":"file:///Users/hakim/demo/tools.go","version":37},"contentChanges":[{"range":{"start":{"line":17,"character":75},"end":{"line":17,"character":83}},"rangeLength":8,"text":""}]}


[Trace - 10:59:24.358 AM] Sending request 'textDocument/formatting - (9)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/demo/tools.go"},"options":{"tabSize":4,"insertSpaces":false}}


[Error - Received] 10:59:24.359 AM #9 18:76: missing ',' before newline in composite literal (and 2 more errors)


[Error - 10:59:24 AM] Request textDocument/formatting failed.
  Message: 18:76: missing ',' before newline in composite literal (and 2 more errors)
  Code: 0 
[Trace - 10:59:24.361 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/hakim/demo/tools.go","version":37,"diagnostics":[{"range":{"start":{"line":17,"character":75},"end":{"line":17,"character":75}},"severity":1,"source":"syntax","message":"missing ',' before newline in composite literal"}]}


[Trace - 10:59:24.406 AM] Sending notification 'textDocument/didSave'.
Params: {"textDocument":{"uri":"file:///Users/hakim/demo/tools.go"}}
```