Add script for updating go.mod to use local plugeth-statediff #3

Merged
roysc merged 5 commits from telackey/ci into main 2023-09-27 07:48:33 +00:00
Showing only changes of commit e70cbb0f26 - Show all commits

View File

@ -11,8 +11,12 @@ fi
CURRENT_REPLACEMENTS=$(go mod edit --json | jq -r '.Replace[] | "\(.Old.Path) \(.New.Path)"') CURRENT_REPLACEMENTS=$(go mod edit --json | jq -r '.Replace[] | "\(.Old.Path) \(.New.Path)"')
grep 'github.com/cerc-io/plugeth-statediff' go.mod >/dev/null
if [ $? -eq 0 ]; then
echo "github.com/cerc-io/plugeth-statediff=${PLUGETH_STATEDIFF_DIR}" echo "github.com/cerc-io/plugeth-statediff=${PLUGETH_STATEDIFF_DIR}"
go mod edit --replace "github.com/cerc-io/plugeth-statediff=${PLUGETH_STATEDIFF_DIR}" go mod edit --replace "github.com/cerc-io/plugeth-statediff=${PLUGETH_STATEDIFF_DIR}"
fi
for r in `go mod edit --json ${PLUGETH_STATEDIFF_DIR}/go.mod | jq -r '.Replace[] | "\(.Old.Path)=\(.New.Path)@\(.New.Version)"'`; do 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) orig=$(echo $r | cut -d'=' -f1)
rep=$(echo $r | cut -d'=' -f2 | cut -d'@' -f1) rep=$(echo $r | cut -d'=' -f2 | cut -d'@' -f1)