Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs Golang gofmt on save hook - not formatting

Tags:

emacs

go

gofmt

after checking path with M-: (eval "PATH") the location of C:/Go/bin shows up, so I know the gofmt binary is found. If i try to do M-x gofmt on other files it will give proper errors (not *.go files).

however I noticed something weird in the Messages which is where the gofmt is trying to format..

Calling gofmt: gofmt (-w c:/Users/LunchBox/AppData/Local/Temp/gofmt5200q9o.go)
Error: (file-error "Searching for program" "no such file or directory" "diff")

why is it looking in the -w /appdata/locals/temp/etc..?
shouldn't it be the file I'm working on currently? which is just called ovRESTful.go in c:/work/users/ovRESTful/ovRESTful.go

the line I have for my code..

(add-hook 'before-save-hook 'gofmt-before-save)
like image 828
Andrei Avatar asked Oct 30 '22 21:10

Andrei


1 Answers

diff is the name of a command to compare files line by line which is usually distributed with unix-derived operating systems.

You could try to install these utilities on windows:

http://gnuwin32.sourceforge.net/packages/diffutils.htm

to see if that helps.

like image 199
cjdp Avatar answered Nov 15 '22 07:11

cjdp