github.com/osrg/gobgp/v3@v3.30.0/tools/grep_avoided_functions.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # List of functions which should not be used with remarkable reasons
     4  FUNCS=(
     5  # On a 32-bit platform, int type is not big enough to convert into uint32 type.
     6  # strconv.Atoi() should be replaced by strconv.ParseUint() or
     7  # strconv.ParseInt().
     8  'strconv\.Atoi'
     9  )
    10  
    11  SCRIPT_DIR=`dirname $0`
    12  cd "${SCRIPT_DIR}/.."
    13  
    14  RESULT=0
    15  
    16  PKG_BASE=github.com/osrg/gobgp/v3
    17  
    18  for FUNC in ${FUNCS[@]}
    19  do
    20      for GO_PKG in $(go list $PKG_BASE/... | grep -v '/vendor/')
    21      do
    22          grep ${FUNC} -r ${GO_PKG#$PKG_BASE/}
    23          if [ $? -ne 1 ]
    24          then
    25              RESULT=1
    26          fi
    27      done
    28  done
    29  
    30  exit $RESULT