发送$ go versiongo version go1.15.2 linux/amd64我想要的是我想用 Go 实现一个微服务。发生了什么当我运行 git commit 时,预先提交运行golint命令,现在它会打印“golint: command not found”。asuha on asuha-HP-EliteDesk-800-G4-TWR in ~/go/src/github.com/Asuha-a/URLShortener/api/services/user(27m|feat/_20_design_backend_architecture*)$ git commit -m "feat: add user app #20"go fmt...................................................................Passedgo lint..................................................................Failed- hook id: go-lint- exit code: 1/home/asuha/.cache/pre-commit/repo5ywtpl6j/run-go-lint.sh: line 7: golint: command not foundgo imports...............................................................Passedgo-cyclo.................................................................Failed- hook id: go-cyclo- exit code: 127/home/asuha/.cache/pre-commit/repo5ywtpl6j/run-go-cyclo.sh: line 9: exec: gocyclo: not foundvalidate toml........................................(no files to check)SkippedCheck files aren't using go's testing package........(no files to check)Skippedgo-unit-tests............................................................Passedgo-mod-tidy..............................................................Passed代码go in .zshrc 的设置export PATH=$PATH:/usr/local/go/binexport GOROOT=/usr/local/goexport GOPATH=$HOME/goexport GOBIN=$GOPATH/bin项目树asuha on asuha-HP-EliteDesk-800-G4-TWR in ~/go/src/github.com/Asuha-a/URLShortener(43m|feat/_20_design_backend_architecture*)$ tree.├── api│ ├── Dockerfile│ ├── go.mod│ ├── go.sum│ ├── main.go│ ├── pb│ └── services│ ├── README.md│ └── user│ ├── go.mod│ ├── go.sum│ └── main.go├── docker-compose.yml└── README.md
1 回答
慕的地10843
TA贡献1785条经验 获得超8个赞
您需要获取并保留对PATH环境变量的更改。如果您使用 bash,您可以将下一个更改添加到.bashrcor .bash_profile(取决于操作系统)。
export GOPATH="${HOME}/go"
export GOROOT="/usr/local/opt/go/libexec"
if [[ $PATH != *$GOPATH* ]]; then
export PATH="${GOPATH}/bin:${PATH}"
fi
if [[ $PATH != *$GOROOT* ]]; then
export PATH="${GOROOT}/bin:${PATH}"
fi
注意:在我的情况下存在$HOME变量,但您可以编写 gopath 的完整路径。
- 1 回答
- 0 关注
- 109 浏览
添加回答
举报
0/150
提交
取消