github.com/rohankumardubey/nomad@v0.11.8/scripts/update_golang_version.sh (about)

     1  #!/bin/sh
     2  
     3  if [ -z "$1" ]; then
     4      echo "usage: $0 GO_VERSION"
     5      echo ""
     6      echo "For example: $0 1.14.3"
     7      exit 1
     8  fi
     9  
    10  golang_version="$1"
    11  
    12  current_version=$(grep -o -e 'golang:[.0-9]*' .circleci/config.yml | head -n1 | cut -d: -f2)
    13  echo "--> Replacing Go ${current_version} with Go ${golang_version} ..."
    14  
    15  # To support both GNU and BSD sed, the regex is looser than it needs to be.
    16  # Specifically, we use "* instead of "?, which relies on GNU extension without much loss of
    17  # correctness in practice.
    18  sed -i'' -e "s|golang:[.0-9]*|golang:${golang_version}|g" \
    19         	.circleci/config/config.yml .circleci/config.yml
    20  sed -i'' -e "s|GOLANG_VERSION:[ \"]*[.0-9]*\"*|GOLANG_VERSION: ${golang_version}|g" \
    21  	.circleci/config/config.yml .circleci/config.yml
    22  
    23  sed -i'' -e "s|\\(golang.org.*version\\) [.0-9]*|\\1 ${golang_version}|g" \
    24  	README.md
    25  
    26  sed -i'' -e "s|go_version=\"*[^\"]*\"*$|go_version=\"${golang_version}\"|g" \
    27  	scripts/vagrant-linux-priv-go.sh scripts/release/mac-remote-build
    28  
    29  echo "--> Checking if there is any remaining references to old versions..."
    30  if git grep -I --fixed-strings "${current_version}" | grep -v -e CHANGELOG.md -e vendor/ -e website/
    31  then
    32  	echo "  ^^ files contain references to old golang version" >&2
    33  	echo "  update script and run again" >&2
    34  	exit 1
    35  fi