github.com/kaydxh/golang@v0.0.131/script/copyright.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # Fail on any error.
     4  set -euo pipefail
     5  # set -o xtrace
     6  
     7  pushd "$(dirname $0)" > /dev/null || exit
     8  SCRIPT_PATH=$(pwd -P)
     9  popd > /dev/null || exit
    10  
    11  for i in $(find . -name '*.go')
    12  do
    13    if  ! grep -q Copyright "$i" ; then
    14       # exclud third_party and tutorial
    15       if [[ "$i" != *"third_party"* && "$i" != *"tutorial"* && "$i" != *".pb."* ]]; then
    16         #echo "$i"
    17         cat "${SCRIPT_PATH}"/copyright.txt "$i" >"$i".new && mv "$i".new "$i"
    18       fi
    19    fi
    20  done