Skip to content

Instantly share code, notes, and snippets.

@porjo
porjo / golower.sh
Last active August 29, 2015 14:05
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/' {} \;