Per platform 'sed' command to format files to have 4 spaces (darwin and linux supported)
This commit is contained in:
parent
518a807773
commit
d99a6a9c5e
19
tools/format
19
tools/format
@ -4,7 +4,24 @@ set -eo pipefail
|
|||||||
|
|
||||||
paths=$(ls tools/*.go examples/*/*.go)
|
paths=$(ls tools/*.go examples/*/*.go)
|
||||||
|
|
||||||
|
gbe_to_4spaces() {
|
||||||
|
local os=$(tr [A-Z] [a-z] <<< "`uname`")
|
||||||
|
case $os in
|
||||||
|
darwin*)
|
||||||
|
sed -i '' -e 's/ / /g' $1
|
||||||
|
;;
|
||||||
|
linux*)
|
||||||
|
sed -i -e 's/ / /g' $1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$os is not supported."
|
||||||
|
echo "Add a proper 'sed' command for your platform to ./tools/format"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
for path in $paths; do
|
for path in $paths; do
|
||||||
gofmt -w=true $path
|
gofmt -w=true $path
|
||||||
sed -i '' -e 's/ / /g' $path
|
gbe_to_4spaces $path
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user