              (t
               (error "invalid rcs patch or internal error in go--apply-rcs-patch")))))))))
 
+(defun go--convert-path (file)
+  (if (and go-native-paths (fboundp 'cygwin-convert-file-name-to-windows))
+      (cygwin-convert-file-name-to-windows file)
+    file))
+
 (defun gofmt ()
   "Format the current buffer according to the gofmt tool."
   (interactive)

                           "-i"
                           "-t"
                           "-f"
                           (file-truename (buffer-file-name (go--coverage-origin-buffer)))
                           "-o"
                           (number-to-string (go--position-bytes point)))
      (with-current-buffer outbuf

      ;; We're using errbuf for the mixed stdout and stderr output. This
      ;; is not an issue because gofmt -w does not produce any stdout
      ;; output in case of success.
      (if (zerop (call-process gofmt-command nil errbuf nil "-w" (go--convert-path tmpfile)))
          (progn
            (if (zerop (call-process-region (point-min) (point-max) "diff" nil patchbuf nil "-n" "-" tmpfile))
                (message "Buffer is already gofmted")
