<commit_before>#!/bin/bash

set -euo pipefail

GO_VERSION="1.11.5"

if [ $CF_STACK == "cflinuxfs2" ]; then
    GO_SHA256="51cab63f3de5e2f75a9036801712e4d7ae9bf226f0b61abce8d784e698148d3b"
elif [ $CF_STACK == "cflinuxfs3" ]; then
    GO_SHA256="ee770df4e1863ee8e07574cb48e0245b61bec8f118faf6ec3742ea89eb20db28"
fi

export GoInstallDir="/tmp/go$GO_VERSION"
mkdir -p $GoInstallDir

if [ ! -f $GoInstallDir/go/bin/go ]; then
  URL=https://buildpacks.cloudfoundry.org/dependencies/go/go${GO_VERSION}.linux-amd64-${CF_STACK}-${GO_SHA256:0:8}.tar.gz

  echo "-----> Download go ${GO_VERSION}"
  curl -s -L --retry 15 --retry-delay 2 $URL -o /tmp/go.tar.gz

  DOWNLOAD_SHA256=$(shasum -a 256 /tmp/go.tar.gz | cut -d ' ' -f 1)

  if [[ $DOWNLOAD_SHA256 != $GO_SHA256 ]]; then
    echo "       **ERROR** SHA256 mismatch: got $DOWNLOAD_SHA256 expected $GO_SHA256"
    exit 1
  fi

  tar xzf /tmp/go.tar.gz -C $GoInstallDir
  rm /tmp/go.tar.gz
fi
if [ ! -f $GoInstallDir/go/bin/go ]; then
  echo "       **ERROR** Could not download go"
  exit 1
fi<commit_msg>Exit out when an unsupported stack is used [#164076510]<commit_after>#!/bin/bash

set -euo pipefail

GO_VERSION="1.11.5"

if [ $CF_STACK == "cflinuxfs2" ]; then
    GO_SHA256="51cab63f3de5e2f75a9036801712e4d7ae9bf226f0b61abce8d784e698148d3b"
elif [ $CF_STACK == "cflinuxfs3" ]; then
    GO_SHA256="ee770df4e1863ee8e07574cb48e0245b61bec8f118faf6ec3742ea89eb20db28"
else
  echo "       **ERROR** Unsupported stack"
  echo "                 See https://docs.cloudfoundry.org/devguide/deploy-apps/stacks.html for more info"
  exit 1
fi

export GoInstallDir="/tmp/go$GO_VERSION"
mkdir -p $GoInstallDir

if [ ! -f $GoInstallDir/go/bin/go ]; then
  URL=https://buildpacks.cloudfoundry.org/dependencies/go/go${GO_VERSION}.linux-amd64-${CF_STACK}-${GO_SHA256:0:8}.tar.gz

  echo "-----> Download go ${GO_VERSION}"
  curl -s -L --retry 15 --retry-delay 2 $URL -o /tmp/go.tar.gz

  DOWNLOAD_SHA256=$(shasum -a 256 /tmp/go.tar.gz | cut -d ' ' -f 1)

  if [[ $DOWNLOAD_SHA256 != $GO_SHA256 ]]; then
    echo "       **ERROR** SHA256 mismatch: got $DOWNLOAD_SHA256 expected $GO_SHA256"
    exit 1
  fi

  tar xzf /tmp/go.tar.gz -C $GoInstallDir
  rm /tmp/go.tar.gz
fi
if [ ! -f $GoInstallDir/go/bin/go ]; then
  echo "       **ERROR** Could not download go"
  exit 1
fi
{'fraction_non_alphanumeric': 0.1471993052540165, 'fraction_numerical': 0.11029092488059053, 'mean_word_length': 3.544378698224852, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '731055', 'n_tokens_mistral': 1124, 'n_tokens_neox': 965, 'n_words': 188}