-
Notifications
You must be signed in to change notification settings - Fork 18k
proposal: format all shell scripts in Go repo with shfmt #45124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Change https://golang.org/cl/303272 mentions this issue: |
Is there some well known formatter for bash scripts? If this just relies on manual formatting, I don't think it's worth doing. It will just get out of date as people edit the scripts. |
@mvdan's |
@ianlancetaylor |
FWIW, this is a |
Thanks, turning this into a proposal. |
|
If we decide to use a common format for shell code, how do we ensure future code changes and additions are properly formatted? For Go code we can usually assume contributors to run EDIT: Or instead of/in addition to a check at TryBot level, provide a pre-commit hook for |
There is a significant cost here: all developers working in the repo must install shfmt and keep it updated, we have to expand git-codereview's formatting purview beyond Go files in some configurable way (we can't impose shfmt on all git-codereview users), and so on. To what benefit? I don't see any. There are basically no arguments over shell syntax today. And there are almost no shell scripts. And perhaps most importantly we don't have tools like gofix or gofmt -r that need to edit shell scripts without making spurious formatting changes. So the three primary benefits of gofmt enforcement do not apply, yet the costs are higher (everyone has gofmt automatically). It looks to me like we should not do this. |
@rsc https://github.com/golang/go/pull/45125/files#diff-5b8253f08bb9def8ccedef35c577b0af4948354c9f31486cadcf58fa978ccac1R111 |
This proposal has been added to the active column of the proposals project |
Based on the discussion above, this proposal seems like a likely decline. |
No change in consensus, so declined. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Update the bash script, format it all.
The text was updated successfully, but these errors were encountered: