Skip to content

Instantly share code, notes, and snippets.

@porjo
Last active August 29, 2015 14:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save porjo/b331df0b3d7e33c30920 to your computer and use it in GitHub Desktop.
Save porjo/b331df0b3d7e33c30920 to your computer and use it in GitHub Desktop.
lowercase Golang error messages
# Look for instantiations of error using fmt.Errorf or errors.New, where first letter is upper-case. Convert that letter to lowercase.
# e.g.
# return fmt.Errorf("User...
# return errors.New("User...
# becomes
# return fmt.Errorf("user...
# return errors.New("user...
find -name '*.go' -exec sed 's/\(\(errors\.New\|fmt\.Errorf\)("\)\([A-Z]\)\(.*\)/\1\l\3\4/' {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment