Avoid/optimize packages.Load
For parsing AST, we use lib called "packages", is go stdlib from x Currently this lib requre all go installation in host, so it platform dependant thing. And most horrible, we need to include all GO setup inside docker release images.
In this ticket, we need at least remove all not needed files from go18-buster image and reduce linter size and at most, replace packages.Load for something else.
read more:
- https://github.com/golang/mock/pull/420
- https://github.com/vektra/mockery/issues/258
Because of this x package requirement, release image increased:
- dev-v1.7.2-rc1 (320.61 MB)
- release-v1.7.1 (5.24 MB)
Also build/stdextractor not needed anymore, because packages.Load used anyway for parsing AST.
previosly we use it to bake std imports inside binary, without parsing it in runtime
I haven't really dug deep into go-arch-lint's source code, but it seems to me, that linting dependencies could be done solely by parsing import statements in a package, which in itself is a rather trivial thing to do. Perhaps, we could replace packages with custom written parser specifically for import sections?
For linting imports, we don't have to use 'packages' at all, that's how it been before in old versions.
But linter with the deepScan flag enabled, reads all GO code, not just imports.
This required to check for dependency injection, function calls, etc.