Skip to content

Commit

Permalink
vet: remove special check for package comment; staticcheck has it
Browse files Browse the repository at this point in the history
  • Loading branch information
dfawley committed Nov 8, 2023
1 parent 9c065a8 commit 9b9e99e
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions vet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,35 +178,4 @@ Target is deprecated: Use the Target field in the BuildOptions instead.
xxx_messageInfo_
' "${SC_OUT}"

# - special golint on package comments.
lint_package_comment_per_package() {
# Number of files in this go package.
fileCount=$(go list -f '{{len .GoFiles}}' $1)
if [ ${fileCount} -eq 0 ]; then
return 0
fi
# Number of package errors generated by golint.
lintPackageCommentErrorsCount=$(golint --min_confidence 0 $1 | grep -c "should have a package comment")
# golint complains about every file that's missing the package comment. If the
# number of files for this package is greater than the number of errors, there's
# at least one file with package comment, good. Otherwise, fail.
if [ ${fileCount} -le ${lintPackageCommentErrorsCount} ]; then
echo "Package $1 (with ${fileCount} files) is missing package comment"
return 1
fi
}
lint_package_comment() {
set +ex

count=0
for i in $(go list ./...); do
lint_package_comment_per_package "$i"
((count += $?))
done

set -ex
return $count
}
lint_package_comment

echo SUCCESS

0 comments on commit 9b9e99e

Please sign in to comment.