Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #4678: top-level 'make lint' wasn't working #4679

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -1000,14 +1000,18 @@ endif
tools:
cd internal/tools && go generate -tags tools ./

LINTFILESCMD=find src/os/ src/reflect/ -type f -name '*.go'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about changing this variable to contain a list of directories to scan? That would be easier to maintain/adjust/expand in future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@b0ch3nski Similar to this? 7190e01

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cibomahto LGTM 👍

.PHONY: lint
lint: tools ## Lint source tree
revive -version
# TODO: lint more directories!
# revive.toml isn't flexible enough to filter out just one kind of error from a checker, so do it with grep here.
# Can't use grep with friendly formatter. Plain output isn't too bad, though.
# Use 'grep .' to get rid of stray blank line
revive -config revive.toml compiler/... src/{os,reflect}/*.go | grep -v "should have comment or be unexported" | grep '.' | awk '{print}; END {exit NR>0}'
revive -config revive.toml compiler/... $$( $(LINTFILESCMD) ) \
| grep -v "should have comment or be unexported" \
| grep '.' \
| awk '{print}; END {exit NR>0}'

SPELLDIRSCMD=find . -depth 1 -type d | egrep -wv '.git|lib|llvm|src'; find src -depth 1 | egrep -wv 'device|internal|net|vendor'; find src/internal -depth 1 -type d | egrep -wv src/internal/wasi
.PHONY: spell
Expand Down
Loading