Permalink
Browse files
Update format script for new gofmt
gofmt no longer supports `tabs` and `tabwidth`, but we still require exactly-4-space tabs to preserve the narrow layout on gobyexample.com, so re-implement this functionality with sed.
- Loading branch information...
Showing
with
11 additions
and 7 deletions.
- +1 −1 tools/build
- +10 −0 tools/format
- +0 −6 tools/gofmt
2
tools/build
10
tools/format
| @@ -0,0 +1,10 @@ | ||
| +#!/bin/bash | ||
| + | ||
| +set -eo pipefail | ||
| + | ||
| +paths=$(ls tools/*.go examples/*/*.go) | ||
| + | ||
| +for path in $paths; do | ||
| + gofmt -w=true $path | ||
| + sed -i '' -e 's/ / /g' $path | ||
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
|
||
| +done | ||
6
tools/gofmt
| @@ -1,6 +0,0 @@ | ||
| -#!/bin/bash | ||
| - | ||
| -set -e | ||
| -set -o pipefail | ||
| - | ||
| -ls tools/*.go examples/*/*.go | xargs gofmt -tabs=false -tabwidth=4 -w=true |
Is
sed -i '' -e 's/ / /g' $pathshould besed -i -e 's/ / /g' $path?Unfortunately I think the exact
sedcommand is environment dependent. This is the one that works in my environment (Mac with BSD sed). It would be nice to have an more portable command here, maybe Perl or something?