github.com/argoproj/argo-cd/v3@v3.2.1/hack/migrate-gitops-engine/replace-vendor.sh (about) 1 #!/bin/bash 2 3 # Script to replace all occurrences of "go mod vendor" with "go work vendor" recursively 4 5 set -e 6 7 # Add common Go binary path to PATH if not already present 8 export PATH=$PATH:/usr/local/go/bin 9 10 go work init ./gitops-engine 11 go work use . 12 go work vendor 13 go mod tidy 14 15 echo "Searching for files containing 'go work vendor'..." 16 17 # Replace in each file 18 for file in Makefile Tiltfile hack/generate-proto.sh .github/workflows/bump-major-version.yaml .github/workflows/ci-build.yaml; do 19 echo "Processing: $file" 20 # Create a backup and replace 21 sed -i.bak 's/go mod vendor/go work vendor/g' "$file" 22 echo " - Replaced occurrences in $file" 23 echo " - Backup created: $file.bak" 24 done 25 26 echo 27 echo "Replacement complete!" 28 echo "Removing backup files..." 29 find . -name '*.bak' -delete 30 31 echo "Syncing go mod files..." 32 go work sync 33 go mod tidy 34 go work vendor 35