如何启动和运行sh格式化程序? [英] How to get the sh formatter up and running?
问题描述
目标是为bash脚本( .sh 文件)设置格式.因此,我尝试使用 .sh格式化程序.从项目的github快速入门部分;我已经安装并像这样拉入 shfmt模块: GO111MODULE = on go获取mvdan.cc/sh/v3/cmd/shfmt
.但是尝试调用 shfmt命令.我收到常见的找不到命令错误.我实际上如何使用 shfmt命令.我的假设是即插即用,即我实际上不需要摆弄 PATH 或 ENV .
The goal is to set up formatting for bash scripts (.sh files). So I'm trying to play around with the .sh formatter. From the project's github quick start section; I have go installed and have pulled in the shfmt module like so: GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt
. But on trying to invoke the shfmt command. I'm getting the common command not found error. How do I actually use the shfmt command. My assumption is this is plug and play i.e. I don't need to actually go and fiddle around with PATHs or ENVs.
推荐答案
该命令以 $ HOME/go/bin/shfmt
安装(除非设置了GOBIN,否则为 $ GOBIN/shfmt
):
The command is installed as $HOME/go/bin/shfmt
(unless GOBIN is set, then it's $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.
这篇关于如何启动和运行sh格式化程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!