Created
August 30, 2019 05:37
-
-
Save soniah/c11633551c6dd84dab66cad20453cfa8 to your computer and use it in GitHub Desktop.
remove all blank lines in go 'imports' statements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# remove all blank lines in go 'imports' statements, | |
# then sort with goimports | |
if [ $# != 1 ] ; then | |
echo "usage: $0 <filename>" | |
exit 1 | |
fi | |
sed -i ' | |
/^import/,/)/ { | |
/^$/ d | |
} | |
' $1 | |
goimports -w $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment