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 關注
- 246 瀏覽
添加回答
舉報