github.com/olljanat/moby@v1.13.1/hack/validate/default-seccomp (about)

     1  #!/bin/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 [ ${#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