英文:
Not able to watch go files after installing Compile Daemon
问题
使用以下命令进行安装:go get github.com/githubnemo/CompileDaemon 和 go install github.com/githubnemo/CompileDaemon。
当我尝试使用 -> CompileDaemon --compile="./folderName" 运行它时,出现了 zsh: command not found: CompileDaemon 的错误。
注意:
- 我正在使用 oh-my-zsh。
- 我的
GOPATH和GOBIN不是默认的,我将其设置为goWorkspace。
英文:
Installed using, go get github.com/githubnemo/CompileDaemon and go install github.com/githubnemo/CompileDaemon
When I try to run it using -> CompileDaemon --compile="./folderName"
It gives -> zsh: command not found: CompileDaemon
Note:
- I'm using oh-my-zsh.
- My
GOPATHandGOBINare not default one's, I set it togoWorkspace
答案1
得分: 2
首先,不要忘记使用go get来构建和安装包已经被弃用了(在早期的Go版本中,go get用于构建和安装包。现在,go get专门用于调整go.mod中的依赖关系)。
你只需要使用go install命令:
go install github.com/githubnemo/CompileDaemon@latest
这将在你的目录中生成一个名为CompileDaemon的可执行文件,该文件的名称由GOBIN环境变量指定。
但是你需要将$GOBIN本身添加到你的$PATH中(例如在你的~/.zshrc文件中):
export PATH="$PATH:$GOBIN"
英文:
First, don't forget that the use of go get to build and install packages is deprecated (In earlier versions of Go, 'go get' was used to build and install packages. Now, 'go get' is dedicated to adjusting dependencies in go.mod.)
All you need should be go install:
go install github.com/githubnemo/CompileDaemon@latest
That should generate a CompileDaemon executable in your directory named by the GOBIN environment variable.
But you need $GOBIN itself in your $PATH (from your ~/.zshrc for instance):
export PATH="$PATH:$GOBIN"
答案2
得分: 1
使用以下命令安装Compile Daemon:
go install github.com/githubnemo/CompileDaemon@latest
重要提示:
确保Compile Daemon可执行文件的路径(即GOBIN)已包含在$PATH中。
你可以通过编辑你的".bashrc"或".zshrc"文件来包含它,
或者通过"export PATH=$PATH:$GOBIN"来添加。
英文:
Install Compile Daemon using
"go install github.com/githubnemo/CompileDaemon@latest"
Important:
Ensure that the Compile Daemon executable path(i.e: GOBIN) is included in $PATH.
You can include it by editing your ".bashrc" or ".zshrc" file.
or by "export PATH=$PATH:$GOBIN"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论