We have added support for monorepos in the Go analyzer.
Background
Before this release, if you had a Go project with import path other than the repository root, or have multiple import paths, some packages would not be loaded, and some issues were not detected.
For example, if the repository lies at github.com/deepsourcelabs/web
and the Go project lies at github.com/deepsourcelabs/web/backend
, in the previous version, the DeepSource analyzer would fail to recognize a lot of packages, and hence, miss out a lot of issues.
What changed
We have now added support for multiple import paths, and handled the scenario when the import path is different from import root.
To do so, we have added 2 new fields to be added in the meta of the .deepsource.toml
file:
import_paths
: An array of import paths that has to be analyzed. In the above repository’s example, the value ofimport_paths
would be["github.com/deepsourcelabs/web/backend"]
.import_root
: The root of the repository. In the above example, the value ofimport_root
would be"github.com/deepsourcelabs/web"
. If theimport_paths
array contains only a single value, and no value is provided forimport_root
, the value of import path is considered the import root.
What about import_path
?
The new field import_paths
(array) is added in place of import_path
(string). While import_path
is still supported for any repository that still uses it, this field has been deprecated, and we would recommend using the import_paths
array.
For more details, refer to the docs.