mirror of
https://github.com/vmware-tanzu/velero.git
synced 2025-12-23 14:25:22 +00:00
* Add linter to Makefile and build image * Also make it part of verify step Signed-off-by: Tony Batard <tbatard@pivotal.io> * clean up of Makefile and permissions for .go/golangci-lint Signed-off-by: Duffie Cooley <cooleyd@vmware.com> * changed verify-lint.sh to lint.sh to avoid breaking ci Signed-off-by: mtritabaugh <mtritabaugh@vmware.com> * Add changelog Signed-off-by: Tony Batard <tbatard@pivotal.io> * Add LINTERS option to run only specific linters * e.g. make lint LINTERS=unused,deadcode Signed-off-by: Tony Batard <tbatard@pivotal.io> * adding timeout to golangci-lint, and checking cache Signed-off-by: Matyas Danter <mdanter@vmware.com> * Fixed some formatting and added comments Signed-off-by: Matyas Danter <mdanter@vmware.com> * modifying lint script to use golangci.yaml Signed-off-by: Matyas Danter <mdanter@vmware.com> * update to move default linters to Makefile Signed-off-by: mtritabaugh <mtritabaugh@vmware.com> * Adding documentation for lint make targets. Signed-off-by: Matyas Danter <mdanter@vmware.com> * Update Copyright with current year Signed-off-by: Tony Batard <tbatard@pivotal.io> * initial git workflow commit Signed-off-by: mtritabaugh <mtritabaugh@vmware.com> * Added lint-all target and implemented -n as default * Added a local-lint-all and lint-all target that will show lint errors for all of the codebase * changed the default of lint and local-lint to only show new lint errors Signed-off-by: Duffie Cooley <cooleyd@vmware.com> * updated docs to reflect new target Signed-off-by: mtritabaugh <mtritabaugh@vmware.com> Co-authored-by: Duffie Cooley <cooleyd@vmware.com> Co-authored-by: mtritabaugh <mtritabaugh@vmware.com> Co-authored-by: Matyas Danter <mdanter@vmware.com>
37 lines
1.0 KiB
Bash
Executable File
37 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Copyright 2020 the Velero contributors.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
LINTERS=${1:-"gosec,goconst,gofmt,goimports,unparam"}
|
|
ALL=${2:-false}
|
|
|
|
HACK_DIR=$(dirname "${BASH_SOURCE[0]}")
|
|
|
|
# Printing out cache status
|
|
golangci-lint cache status
|
|
|
|
if [[ $ALL == true ]] ; then
|
|
action=""
|
|
else
|
|
action="-n"
|
|
fi
|
|
|
|
# Enable GL_DEBUG line below for debug messages for golangci-lint
|
|
# export GL_DEBUG=loader,gocritic,env
|
|
CMD="golangci-lint run -E ${LINTERS} $action -c $HACK_DIR/../golangci.yaml"
|
|
echo "Running $CMD"
|
|
|
|
eval $CMD
|