Skip to content

Instantly share code, notes, and snippets.

@soniah
Created August 30, 2019 05:37
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save soniah/c11633551c6dd84dab66cad20453cfa8 to your computer and use it in GitHub Desktop.
Save soniah/c11633551c6dd84dab66cad20453cfa8 to your computer and use it in GitHub Desktop.
remove all blank lines in go 'imports' statements
#!/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