Add script for using local plugeth-statediff.
This commit is contained in:
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
PLUGETH_STATEDIFF_DIR=`echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"`
|
||||
TARGET_GOMOD_DIR=${2}
|
||||
|
||||
cd $TARGET_GOMOD_DIR
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Unable to cd to $TARGET_GOMOD_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CURRENT_REPLACEMENTS=$(go mod edit --json | jq -r '.Replace[] | "\(.Old.Path) \(.New.Path)"')
|
||||
|
||||
go mod edit --replace "github.com/cerc-io/plugeth-statediff=${PLUGETH_STATEDIFF_DIR}"
|
||||
for r in `go mod edit --json ${PLUGETH_STATEDIFF_DIR}/go.mod | jq -r '.Replace[] | "\(.Old.Path)=\(.New.Path)@\(.New.Version)"'`; do
|
||||
orig=$(echo $r | cut -d'=' -f1)
|
||||
rep=$(echo $r | cut -d'=' -f2 | cut -d'@' -f1)
|
||||
echo "$CURRENT_REPLACEMENTS" | grep "$orig" | grep "$rep" > /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
continue;
|
||||
fi
|
||||
go mod edit --replace "$r"
|
||||
done
|
||||
|
||||
go mod tidy -e 2>/dev/null
|
||||
Reference in New Issue
Block a user