github.com/mshitrit/go-mutesting@v0.0.0-20210528084812-ff81dcaedfea/scripts/lint.sh (about)

     1  #!/bin/sh
     2  
     3  if [ -z ${PKG+x} ]; then echo "PKG is not set"; exit 1; fi
     4  if [ -z ${ROOT_DIR+x} ]; then echo "ROOT_DIR is not set"; exit 1; fi
     5  
     6  echo "gofmt:"
     7  OUT=$(gofmt -l -s $ROOT_DIR 2>&1 | grep --invert-match -E "(/example)")
     8  if [ -n "$OUT" ]; then echo "$OUT"; PROBLEM=1; fi
     9  
    10  echo "errcheck:"
    11  OUT=$(errcheck $PKG/... 2>&1 | grep --invert-match -E "(/example)")
    12  if [ -n "$OUT" ]; then echo "$OUT"; PROBLEM=1; fi
    13  
    14  echo "go vet:"
    15  OUT=$(go tool vet -all=true -v=true $ROOT_DIR 2>&1 | grep --invert-match -E "(Checking file|\%p of wrong type|can't check non-constant format|/example)")
    16  if [ -n "$OUT" ]; then echo "$OUT"; PROBLEM=1; fi
    17  
    18  echo "golint:"
    19  OUT=$(golint $PKG/... 2>&1 | grep --invert-match -E "(/example)")
    20  if [ -n "$OUT" ]; then echo "$OUT"; PROBLEM=1; fi
    21  
    22  echo "megacheck:"
    23  OUT=$(megacheck $PKG/... 2>&1 | grep --invert-match -E "(example/)")
    24  if [ -n "$OUT" ]; then echo "$OUT"; PROBLEM=1; fi
    25  
    26  if [ -n "$PROBLEM" ]; then exit 1; fi