github.com/osrg/gobgp@v2.0.0+incompatible/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  
    13  RESULT=0
    14  
    15  for FUNC in ${FUNCS[@]}
    16  do
    17      for GO_PKG in $(go list github.com/osrg/gobgp/... | grep -v '/vendor/')
    18      do
    19          grep ${FUNC} -r ${GOPATH}/src/${GO_PKG}
    20          if [ $? -ne 1 ]
    21          then
    22              RESULT=1
    23          fi
    24      done
    25  done
    26  
    27  exit $RESULT