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

top level 'make lint' target fails #4678

Open
cibomahto opened this issue Jan 2, 2025 · 2 comments
Open

top level 'make lint' target fails #4678

cibomahto opened this issue Jan 2, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@cibomahto
Copy link
Contributor

Using the latest tinygo release 2a76ceb (but also the dev branch), if I attempt to run 'make lint', it fails:

make lint
/bin/sh: 1: node: not found
cd internal/tools && go generate -tags tools ./
go: downloading github.com/mgechev/revive v1.3.9
go: downloading github.com/golangci/misspell v0.6.0
go: downloading github.com/mitchellh/go-homedir v1.1.0
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/fatih/color v1.17.0
go: downloading github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517
go: downloading github.com/spf13/afero v1.11.0
go: downloading github.com/hashicorp/go-version v1.7.0
go: downloading github.com/BurntSushi/toml v1.4.0
go: downloading github.com/chavacava/garif v0.1.0
go: downloading github.com/olekukonko/tablewriter v0.0.5
go: downloading github.com/fatih/structtag v1.2.0
go: downloading golang.org/x/tools v0.23.0
go: downloading golang.org/x/text v0.14.0
go: downloading github.com/mattn/go-colorable v0.1.13
go: downloading github.com/mattn/go-isatty v0.0.20
go: downloading github.com/mattn/go-runewidth v0.0.9
go: downloading golang.org/x/sys v0.22.0
revive -version
version 1.3.9
# 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}'
linting - getting packages: getting packages - resolving packages in dots: malformed import path "src/{os,reflect}/*.go": invalid char '{'
@cibomahto
Copy link
Contributor Author

cibomahto commented Jan 2, 2025

If I replace the failing glob with find, so that it checks all of the files in src/:

LINTFILESCMD=find src/ -type f -name '*.go'
.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
        echo $$( $(LINTFILESCMD) )
        revive -config revive.toml compiler/... $$( $(LINTFILESCMD) ) \
                | grep -v "should have comment or be unexported" \
                | grep '.' \
                | awk '{print}; END {exit NR>0}'

It runs for a while but then runs out of memory on my 16GB machine

Restricting it to just the original directories seems to work (but now it finds linting issues ;-) )

LINTFILESCMD=find src/os/ src/reflect/ -type f -name '*.go'
.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
        echo $$( $(LINTFILESCMD) )
        revive -config revive.toml compiler/... $$( $(LINTFILESCMD) ) \
                | grep -v "should have comment or be unexported" \
                | grep -v "don't use ALL_CAPS in Go names; use CamelCase" \
                | grep '.' \
                | awk '{print}; END {exit NR>0}'

@cibomahto
Copy link
Contributor Author

It appears that this is failing when run in circle-ci as well (taking a random run for example): https://app.circleci.com/pipelines/github/tinygo-org/tinygo/12145/workflows/e2c5864b-f22e-4c22-8cb4-faf12b20712b/jobs/45681?invite=true#step-116-1317_118

cibomahto added a commit to Blinkinlabs/tinygo that referenced this issue Jan 2, 2025
The revive command seems to have had a syntax error in the file
input glob. It appears to have been broken in a way that did not
result in a return code being set. This change uses 'find' to
build the input to the linter.

Note that it is expected to fail the CI script, because it is
uncovering some existing lint issues that were not being caught.
@deadprogram deadprogram added the bug Something isn't working label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants