golangci-lint
golangci-lint copied to clipboard
Speed up packages loading for large projects
In projects like Istio even repeated packages loading takes ~10s. E.g. 8s for Istio. It's important with incremental analysis when 2s we load issues from the cache and 8s load packages. We can cache packages metadata in our file cache and build our own go list
implementation using this cache.
In the setup I'm working with, we're executing GolangCI Lint in a docker image, where the code is mounted into the container. We're finding that linting has become cripplingly slow: often we find that we're hitting the linting deadline of multiple minutes. Note that we're currently using GolangCI Lint 1.19, though I will work at verifying with a more recent version when I can.
Through enabling verbose mode and the loader debugging, I can see that the bulk of the time is spent executing go list
(upwards of 2 minutes). This is so long because the docker container has no existing go build
cache: if the build cache is pre-initialised beforehand (say by running the same long running go list
command before GolangCI Lint has to), then execution is much quicker (though we're still looking at >10s in the projects I'm working on)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.