This reworks the logic in the lint script for determining which modules to lint to use the existence of a go.mod file instead of attempting to use the result of go list.
The existing logic is to pick the dependencies out of output of go list which have the main module as a prefix. However, that is error prone because go list also reports indirect dependencies which may themselves depend on older versions of modules that are no longer in the repo, but naturally have the prefix that is being filtered.
Searching for the go.mod files in the repo is a simpler approach that isn't prone to the aforementioned issue while still dynamically finding all modules in the repo.
This reworks the logic in the lint script for determining which modules to lint to use the existence of a
go.mod
file instead of attempting to use the result ofgo list
.The existing logic is to pick the dependencies out of output of
go list
which have the main module as a prefix. However, that is error prone becausego list
also reports indirect dependencies which may themselves depend on older versions of modules that are no longer in the repo, but naturally have the prefix that is being filtered.Searching for the
go.mod
files in the repo is a simpler approach that isn't prone to the aforementioned issue while still dynamically finding all modules in the repo.