github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/hack/validate/default-seccomp (about)

     1  #!/usr/bin/env bash
     2  
     3  export SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
     4  source "${SCRIPTDIR}/.validate"
     5  
     6  IFS=$'\n'
     7  files=($(validate_diff --diff-filter=ACMR --name-only -- 'profiles/seccomp' || true))
     8  unset IFS
     9  
    10  if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ ${#files[@]} -gt 0 ]; then
    11  	# We run 'go generate' and see if we have a diff afterwards
    12  	go generate ./profiles/seccomp/ > /dev/null
    13  	# Let see if the working directory is clean
    14  	diffs="$(git status --porcelain -- profiles/seccomp 2> /dev/null)"
    15  	if [ "$diffs" ]; then
    16  		{
    17  			echo 'The result of go generate ./profiles/seccomp/ differs'
    18  			echo
    19  			echo "$diffs"
    20  			echo
    21  			echo 'Please re-run go generate ./profiles/seccomp/'
    22  			echo
    23  		} >&2
    24  		false
    25  	else
    26  		echo 'Congratulations!  Seccomp profile generation is done correctly.'
    27  	fi
    28  fi