#!/bin/bash

if [[ "$TRAVIS_GO_VERSION" =~ ^1\.(12|13)(\..*)?$ ]]; then
  exit 0
fi

GO111MODULE=on go generate ./...
if [ -n "$(git diff)" ]; then
  echo "Go generate had not been run"
  git diff
  exit 1
fi

#!/bin/bash

# If GOMOD is defined we are running with Go Modules enabled, either
# automatically or via the GO111MODULE=on environment variable. Codegen only
# works with modules, so skip generation if modules is not in use.
if [[ ! -z "$(go env GOMOD)" ]]; then
  exit 0
fi

go generate ./...
if [ -n "$(git diff)" ]; then
  echo "Go generate had not been run"
  git diff
  exit 1
fi

Make the go generate script better and more similar to PR 853
Make the go generate script better and more similar to PR 853
