go.uber.org/cadence@v1.2.9/scripts/check-gomod-version.sh (about)

     1  #!/usr/bin/env bash
     2  set -eo pipefail
     3  
     4  [[ $2 = "-v" ]] && set -x;
     5  
     6  if ! gomod="$(go list -mod=readonly -f '{{ .Module }}' "$1")"; then
     7      >&2 echo 'Error checking main go.mod.'
     8      exit 1
     9  fi
    10  
    11  if ! toolmod="$(go list -mod=readonly -modfile=internal/tools/go.mod -f '{{ .Module }}' "$1")"; then
    12      >&2 echo 'Error checking tools go.mod, cd to internal/tools to modify it.'
    13      exit 1
    14  fi
    15  
    16  if [[ $gomod != $toolmod ]]; then
    17  	>&2 echo "error: mismatched go.mod and tools go.mod"
    18      >&2 echo "ensure internal/tools/go.mod contains the same version as go.mod and try again:"
    19      >&2 echo -e "\t$gomod"
    20  	exit 1
    21  fi