fe3dback / go-arch-lint

GoLang architecture linter (checker) tool. Will check all project import path and compare with arch rules defined in yml file. Useful for hexagonal / onion / ddd / mvc and other architectural patterns. Tool can by used in your CI
MIT License
254 stars 12 forks source link

Avoid/optimize packages.Load #36

Open fe3dback opened 2 years ago

fe3dback commented 2 years ago

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:

fe3dback commented 2 years ago

Because of this x package requirement, release image increased:

fe3dback commented 2 years ago

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

SealOfTime commented 8 months ago

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?

fe3dback commented 8 months ago

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.