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.
This commit is contained in:
Joel Scoble 2014-12-12 10:06:35 -06:00 committed by Mark McGranaghan
parent a2fe5f2db4
commit 8e7a6bb086
3 changed files with 11 additions and 7 deletions

View File

@ -2,6 +2,6 @@
set -e set -e
tools/gofmt tools/format
tools/measure tools/measure
tools/generate tools/generate

10
tools/format Executable file
View File

@ -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
done

View File

@ -1,6 +0,0 @@
#!/bin/bash
set -e
set -o pipefail
ls tools/*.go examples/*/*.go | xargs gofmt -tabs=false -tabwidth=4 -w=true