Skip to content

Commit

Permalink
Merge pull request #19085 from ivanvc/remove-receiver-name-check
Browse files Browse the repository at this point in the history
scripts: remove receiver name check
  • Loading branch information
serathius authored Dec 19, 2024
2 parents b531071 + d2d1678 commit 21021b2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 28 deletions.
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fuzz:
# Static analysis
.PHONY: verify
verify: verify-gofmt verify-bom verify-lint verify-dep verify-shellcheck verify-goword \
verify-govet verify-license-header verify-receiver-name verify-mod-tidy \
verify-govet verify-license-header verify-mod-tidy \
verify-shellws verify-proto-annotations verify-genproto verify-yamllint \
verify-govet-shadow verify-markdown-marker verify-go-versions

Expand Down Expand Up @@ -113,10 +113,6 @@ verify-govet:
verify-license-header:
PASSES="license_header" ./scripts/test.sh

.PHONY: verify-receiver-name
verify-receiver-name:
PASSES="receiver_name" ./scripts/test.sh

.PHONY: verify-mod-tidy
verify-mod-tidy:
PASSES="mod_tidy" ./scripts/test.sh
Expand Down
23 changes: 0 additions & 23 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -433,29 +433,6 @@ function license_header_pass {
run_for_modules generic_checker license_header_per_module
}

function receiver_name_for_package {
# bash 3.x compatible replacement of: mapfile -t gofiles < <(go_srcs_in_module)
local gofiles=()
while IFS= read -r line; do gofiles+=("$line"); done < <(go_srcs_in_module)

recvs=$(grep 'func ([^*]' "${gofiles[@]}" | tr ':' ' ' | \
awk ' { print $2" "$3" "$4" "$1 }' | sed "s/[a-zA-Z\\.]*go//g" | sort | uniq | \
grep -Ev "(Descriptor|Proto|_)" | awk ' { print $3" "$4 } ' | sort | uniq -c | grep -v ' 1 ' | awk ' { print $2 } ')
if [ -n "${recvs}" ]; then
# shellcheck disable=SC2206
recvs=($recvs)
for recv in "${recvs[@]}"; do
log_error "Mismatched receiver for $recv..."
grep "$recv" "${gofiles[@]}" | grep 'func ('
done
return 255
fi
}

function receiver_name_pass {
run_for_modules receiver_name_for_package
}

# goword_for_package package
# checks spelling and comments in the 'package' in the current module
#
Expand Down

0 comments on commit 21021b2

Please sign in to comment.