Vectrum
Sign In
15 lines · 618 Bytes · Shell
#!/usr/bin/env bash
set -euo pipefail
export GOPROXY=off GOFLAGS=-mod=mod
go build ./... 2>&1
go test ./... 2>&1
if grep -rn '\bCfg\b\|DefaultCfg' --include='*.go' .; then
  echo "the old name is still present"
  exit 1
fi
grep -q 'type Config struct' config.go || { echo "Config type not defined"; exit 1; }
grep -q 'func DefaultConfig' config.go || { echo "DefaultConfig not defined"; exit 1; }
for f in internal/server/server.go internal/worker/worker.go internal/store/store.go internal/cli/cli.go; do
  grep -q 'app.Config' "$f" || { echo "$f was not updated"; exit 1; }
done
echo "renamed across all call sites"