英文:
How to run go generate with executable file in the same folder
问题
我在与go generate命令所在的同一文件夹中有可执行文件。
当我运行该命令时,会出现错误:
在$PATH中找不到可执行文件。
但是我在同一文件夹中有可执行文件,请参考下面的图片:
我当前正在运行:
go:generate convert
如何让go:generate在同一文件夹中查找二进制文件?
英文:
I have the executable file in the same folder as where go generate command is written
when I run the command it gives an error
executable file not found in $PATH
But I have the executable in the same folder See image below
Currently I am running
go:generate convert
How to make go:generate look for binary in the same folder
答案1
得分: 3
尝试:
go:generate ./convert
你的可执行文件 convert
不在系统的路径中,所以你需要给它一个相对路径(如上面的例子)或者绝对路径,以便 go generate
或任何子系统能够执行它。
英文:
Try:
go:generate ./convert
Your executable convert
is not in your system's path, so you need to give it a relative (as in the above case) or an absolute path for go generate
or any sub-system to execute it.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论