github.com/vtuson/helm@v2.8.2+incompatible/scripts/validate-go.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # Copyright 2016 The Kubernetes Authors All rights reserved.
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #     http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  set -euo pipefail
    17  
    18  exit_code=0
    19  
    20  if ! hash gometalinter.v1 2>/dev/null ; then
    21    go get -u gopkg.in/alecthomas/gometalinter.v1
    22    gometalinter.v1 --install
    23  fi
    24  
    25  echo
    26  echo "==> Running static validations <=="
    27  # Run linters that should return errors
    28  gometalinter.v1 \
    29    --disable-all \
    30    --enable deadcode \
    31    --severity deadcode:error \
    32    --enable gofmt \
    33    --enable ineffassign \
    34    --enable misspell \
    35    --enable vet \
    36    --tests \
    37    --vendor \
    38    --deadline 60s \
    39    ./... || exit_code=1
    40  
    41  echo
    42  echo "==> Running linters <=="
    43  # Run linters that should return warnings
    44  gometalinter.v1 \
    45    --disable-all \
    46    --enable golint \
    47    --vendor \
    48    --skip proto \
    49    --deadline 60s \
    50    ./... || :
    51  
    52  exit $exit_code