github.com/verrazzano/verrazzano-monitoring-operator@v0.0.30/build/scripts/coverage.sh (about)

     1  #!/bin/bash
     2  #
     3  # Copyright (c) 2020, Oracle and/or its affiliates.
     4  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     5  #
     6  # Code coverage generation
     7  CVG_EXCLUDE="${CVG_EXCLUDE:-test}"
     8  
     9  go test -coverpkg=./... -coverprofile ./coverage.cov $(go list ./... |  grep -Ev "${CVG_EXCLUDE}")
    10  
    11  # Display the global code coverage.  This generates the total number the badge uses
    12  go tool cover -func=coverage.cov ;
    13  
    14  # If needed, generate HTML report
    15  if [ "$1" == "html" ]; then
    16      go tool cover -html=coverage.cov -o coverage.html ;
    17  fi
    18  
    19  
    20