2 回答

TA贡献1966条经验 获得超4个赞
该命令安装为$HOME/go/bin/shfmt(除非设置了 GOBIN,否则为$GOBIN/shfmt):
$ go help install
usage: go install [-i] [build flags] [packages]
Install compiles and installs the packages named by the import paths.
Executables are installed in the directory named by the GOBIN environment
variable, which defaults to $GOPATH/bin or $HOME/go/bin if the GOPATH
environment variable is not set.

TA贡献2039条经验 获得超8个赞
go install
正如彼得所说,安装是在命令的帮助下进行的。我想一步一步地在 Windows 7 机器上为我工作,因为我敢打赌,你们中的一些人对 Go 语言一无所知,甚至不想听到它:
从 golang.org 安装 go 语言(我当然使用了 Windows 安装程序)
下载.sh 格式化程序并将其解压缩到某处
使用您最喜欢的终端导航到根目录 ..\sh-master(我使用GitBash,或者您可以使用每个 Windows 默认具有的 cmd.exe)
运行命令
go install
和安装应该开始安装完成后,通过终端(GitBash 或 cmd)导航到 $HOME/go/bin(在 Windows 上默认位于 C:\Users\your_username\go\bin 下)
从这里您可以像这样使用 shfmt 命令
shfmt -l -w yourBashScript.sh
瞧!现在您的 bash 脚本 yourBashScript.sh 已修改和格式化)
- 2 回答
- 0 关注
- 256 浏览
添加回答
举报