Skip to content

Instantly share code, notes, and snippets.

@gonzaloserrano
Created September 27, 2019 10:33
Show Gist options
  • Save gonzaloserrano/a33e02760d7f5940ca7c9ebad245eb67 to your computer and use it in GitHub Desktop.
Save gonzaloserrano/a33e02760d7f5940ca7c9ebad245eb67 to your computer and use it in GitHub Desktop.
Gorename the ez "easy" way
#! /bin/bash
# makes gorename work with relative pkg paths
command -v gorename >/dev/null 2>&1 || { echo >&2 "I require gorename to run. Install with go get golang.org/x/tools/cmd/gorename. Aborting."; exit 1; }
if [ $# -ne 2 ]; then
echo >&2 "I require two args: origin symbol and destination symbol. Aborting."
exit 1
fi
PWD=$(pwd)
PWD=${PWD#"$GOPATH"}
PWD=${PWD:5}
GO111MODULE=off gorename -from \"$PWD\".$1 -to $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment