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:
parent
a2fe5f2db4
commit
8e7a6bb086
@ -2,6 +2,6 @@
|
||||
|
||||
set -e
|
||||
|
||||
tools/gofmt
|
||||
tools/format
|
||||
tools/measure
|
||||
tools/generate
|
||||
|
10
tools/format
Executable file
10
tools/format
Executable 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
|
@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
ls tools/*.go examples/*/*.go | xargs gofmt -tabs=false -tabwidth=4 -w=true
|
Loading…
x
Reference in New Issue
Block a user