-
-
Save zchee/ce0720f505fc6b9f9b54d8c355d5e37d to your computer and use it in GitHub Desktop.
Go 1.13 error format migration script
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 | |
FILES=$@ | |
echo "Migrate: $FILES" | |
sed -i "s/errors.Wrapf(\(.*\), \"\(.*\)\", \(.*\))/fmt.Errorf(\"\2: %w\", \3, \1)/g" $FILES | |
sed -i "s/errors.Wrap(\(.*\), \"\(.*\)\")/fmt.Errorf(\"\2: %w\", \1)/g" $FILES | |
sed -i "s/errors.Errorf/fmt.Errorf/g" $FILES | |
goimports -w . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment