英文:
Installing soda cli in existing app golang
问题
描述
在现有应用程序中安装soda cli时出现问题。我按照文档下载了cli。
https://gobuffalo.io/en/docs/db/toolbox
复现步骤
$ go get github.com/gobuffalo/pop/...
$ go install github.com/gobuffalo/pop/soda
期望的行为
当我输入soda -v时,它应该显示soda的版本号。
实际的行为
soda: 命令未找到
信息
操作系统:ubuntu 21
英文:
Description
Issue while installing soda cli in existing app
I downloaded the cli like the documentation
https://gobuffalo.io/en/docs/db/toolbox
Steps to Reproduce the Problem
$ go get github.com/gobuffalo/pop/...
$ go install github.com/gobuffalo/pop/soda
Expected Behavior
when i write soda -v
it must show soda version
Actual Behavior
soda: command not found
Info
OS: ubuntu 21
答案1
得分: 2
问题很可能是soda
二进制文件安装的路径不在您的PATH
系统变量中。
要知道您的Go二进制文件安装在哪里,请运行:
go env | grep GOPATH
这将打印出:
GOPATH="/path/to/go"
然后,您需要将/path/to/go/bin
添加到您的环境变量中,可以通过.bashrc
、.zshrc
、.profile
或其他需要将其添加到环境中的文件,添加以下行:
export PATH="$PATH:/path/to/go/bin"
您可以使用一条命令完成所有操作:
echo "export PATH=\"$PATH:${$(go env | grep GOPATH | cut -d '=' -f2):1:-1}/bin\"" >> .bashrc
英文:
The problem is very probably that the path where the soda
binary gets installed is not in your PATH
system variable.
To know where your go binaries are installed, run:
go env | grep GOPATH
This will print:
GOPATH="/path/to/go"
Then you need to add /path/to/go/bin
in your environment, through your .bashrc
, .zshrc
, .profile
or whatever you need to have it in your environment, adding the line:
export PATH="$PATH:/path/to/go/bin"
You can do all of this in one single command:
echo "export PATH=\"$PATH:${$(go env | grep GOPATH | cut -d '=' -f2):1:-1}/bin\"" >> .bashrc
答案2
得分: 0
如果在go/bin目录下安装了soda,
只需为soda添加一个别名
打开终端并输入以下命令
alias soda="~/go/bin/soda"
要创建永久别名
sudo nano ~/.bashrc
在文件末尾写入别名
alias soda="~/go/bin/soda"
英文:
If soda is installed inside go/bin
Just add an alias for soda
Open your terminal and write this command
alias soda="~/go/bin/soda"
To write permanent alias
sudo nano ~/.bashrc
And in the end of file write the alias
alias soda="~/go/bin/soda"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论