安装Compile Daemon后无法查看go文件。

huangapple go评论106阅读模式
英文:

Not able to watch go files after installing Compile Daemon

问题

使用以下命令进行安装:go get github.com/githubnemo/CompileDaemongo install github.com/githubnemo/CompileDaemon

当我尝试使用 -> CompileDaemon --compile="./folderName" 运行它时,出现了 zsh: command not found: CompileDaemon 的错误。

注意:

  • 我正在使用 oh-my-zsh。
  • 我的 GOPATHGOBIN 不是默认的,我将其设置为 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 GOPATH and GOBIN are not default one's, I set it to goWorkspace

答案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"

huangapple
  • 本文由 发表于 2023年1月16日 13:56:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/75130647.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定