regen-gapic: fixup client version

Following https://github.com/googleapis/gapic-generator/pull/2390,
the version constant is embedded into the client library itself.
This script updates the version with the time of client generation.

Currently the script is a no-op because the versionClient variable
doesn't exist yet, but it should take effect the new time we generate
with new gapic-generator.

Change-Id: I6e61d950d49f9c4a9082ae0984909a1bacf17812
Reviewed-on: https://code-review.googlesource.com/c/34490
Reviewed-by: Jean de Klerk <deklerk@google.com>
diff --git a/regen-gapic.sh b/regen-gapic.sh
index 7de6776..91bf069 100755
--- a/regen-gapic.sh
+++ b/regen-gapic.sh
@@ -70,6 +70,13 @@
   cp -r artman-genfiles/gapi-*/cloud.google.com/go/* $GOPATH/src/cloud.google.com/go/
 done
 
+# NOTE(pongad): `sed -i` doesn't work on Macs, because -i option needs an argument.
+# `-i ''` doesn't work on GNU, since the empty string is treated as a file name.
+# So we just create the backup and delete it after.
+ver=$(date +%Y%m%d)
+find $GOPATH/src/cloud.google.com/go/ -name '*.go' -exec sed -i.backup -e "s/^const versionClient.*/const versionClient = \"$ver\"/" '{}' +
+find $GOPATH/src/cloud.google.com/go/ -name '*.backup' -delete
+
 #go list cloud.google.com/go/... | grep apiv | xargs go test
 
 #go test -short cloud.google.com/go/...