mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Fix golint command to only pass a single *.go file at a time
This commit is contained in:
parent
5b6639922d
commit
f4834bbc32
@ -71,10 +71,15 @@ errors=()
|
|||||||
not_failing=()
|
not_failing=()
|
||||||
for p in "${all_packages[@]}"; do
|
for p in "${all_packages[@]}"; do
|
||||||
# Run golint on package/*.go file explicitly to validate all go files
|
# Run golint on package/*.go file explicitly to validate all go files
|
||||||
# and not just the ones for the current platform.
|
# and not just the ones for the current platform. This also will ensure that
|
||||||
# Packages with a corresponding foo_test package will make golint fail
|
# _test.go files are linted.
|
||||||
# with a useless error. Just ignore that, see golang/lint#68.
|
# Generated files are ignored, and each file is passed through golint
|
||||||
failedLint=$(golint "$p"/*.go 2>/dev/null)
|
# individually, as if one file in the package contains a fatal error (such as
|
||||||
|
# a foo package with a corresponding foo_test package), golint seems to choke
|
||||||
|
# completely.
|
||||||
|
# Ref: https://github.com/kubernetes/kubernetes/pull/67675
|
||||||
|
# Ref: https://github.com/golang/lint/issues/68
|
||||||
|
failedLint=$(ls "$p"/*.go | egrep -v "(zz_generated.*.go|generated.pb.go|generated.proto|types_swagger_doc_generated.go)" | xargs -L1 golint 2>/dev/null)
|
||||||
array_contains "$p" "${failing_packages[@]}" && in_failing=$? || in_failing=$?
|
array_contains "$p" "${failing_packages[@]}" && in_failing=$? || in_failing=$?
|
||||||
if [[ -n "${failedLint}" ]] && [[ "${in_failing}" -ne "0" ]]; then
|
if [[ -n "${failedLint}" ]] && [[ "${in_failing}" -ne "0" ]]; then
|
||||||
errors+=( "${failedLint}" )
|
errors+=( "${failedLint}" )
|
||||||
|
Loading…
Reference in New Issue
Block a user