(contents []byte)
| 63 | } |
| 64 | |
| 65 | func FormatGoCode(contents []byte) []byte { |
| 66 | gofmtPath, err := ResolveGoFmtPath() |
| 67 | if err != nil { |
| 68 | return contents |
| 69 | } |
| 70 | |
| 71 | cmd := exec.Command(gofmtPath) |
| 72 | cmd.Stdin = bytes.NewReader(contents) |
| 73 | formattedOutput, err := cmd.Output() |
| 74 | if err != nil { |
| 75 | return contents |
| 76 | } |
| 77 | |
| 78 | return formattedOutput |
| 79 | } |
no test coverage detected