英文:
Emacs Golang gofmt on save hook - not formatting
问题
在使用 M-: (eval "PATH") 检查路径后,我发现 C:/Go/bin 的位置显示出来了,所以我知道 [tag:gofmt] 二进制文件是可以找到的。如果我尝试在其他文件上执行 M-x gofmt,它会给出正确的错误提示(不是 *.go 文件)。
然而,我注意到在 Messages 中有一些奇怪的地方,那就是 gofmt 尝试格式化的地方...
> 调用 gofmt: gofmt (-w c:/Users/LunchBox/AppData/Local/Temp/gofmt5200q9o.go)
> 错误: (file-error "搜索程序" "没有这个文件或目录" "diff")
为什么它在 -w /appdata/locals/temp/etc 中查找呢?
它不应该是我当前正在工作的文件吗?我的文件只是叫做 c:/work/users/ovRESTful/ovRESTful.go
我代码中的这行是:
(add-hook 'before-save-hook 'gofmt-before-save)
英文:
after checking path with M-: (eval "PATH") the location of C:/Go/bin shows up, so I know the [tag: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)
答案1
得分: 2
diff是一个用于逐行比较文件的命令,通常与类Unix操作系统一起分发。
你可以尝试在Windows上安装这些实用程序:
http://gnuwin32.sourceforge.net/packages/diffutils.htm
看看是否有帮助。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论