https://redis.com/blog/go-redis-official-redis-client/
curl https://gist.github.com/dolmen/9f5b4b1892588a5a8948a7c8e116660b/raw/dafeeb86c5c1c1fe80499b0c652f218c3c69aebd/migrate-go-redis-v9.sh | bashhttps://redis.com/blog/go-redis-official-redis-client/
curl https://gist.github.com/dolmen/9f5b4b1892588a5a8948a7c8e116660b/raw/dafeeb86c5c1c1fe80499b0c652f218c3c69aebd/migrate-go-redis-v9.sh | bash| #!/usr/bin/env bash | |
| set -euo pipefail | |
| # Will fail if go-redis v8 is not referenced in go.mod | |
| go list -m github.com/go-redis/redis/v8 >/dev/null | |
| # Add v9 | |
| go get github.com/redis/go-redis/v9@latest | |
| # Chdir to the root of the module | |
| cd "$(go list -m -f '{{.Dir}}')" | |
| # Migrate all Go source in the module | |
| sed -i '' 's!"github.com/go-redis/redis/v8"!"github.com/redis/go-redis/v9"!' $(grep -l github.com/go-redis/redis/v8 $(go list -f '{{$Dir := .Dir}}{{range .GoFiles}}{{$Dir}}/{{.}} {{end}}{{range .XTestGoFiles}}{{$Dir}}/{{.}} {{end}}' ./... ) ) | |
| # Cleanup go.mod/go.sum | |
| go mod tidy | |
| # Build to raise migration issues. Ex: Client.SetEX -> Client.SetEx | |
| exec go build |