github.com/cloudposse/helm@v2.2.3+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 gosimple \ 34 --enable ineffassign \ 35 --enable misspell \ 36 --enable vet \ 37 --tests \ 38 --vendor \ 39 --deadline 60s \ 40 ./... || exit_code=1 41 42 echo 43 echo "==> Running linters <==" 44 # Run linters that should return warnings 45 gometalinter.v1 \ 46 --disable-all \ 47 --enable golint \ 48 --vendor \ 49 --skip proto \ 50 --deadline 60s \ 51 ./... || : 52 53 exit $exit_code