Skip to content

Better document and/or change special handling for Go modules

Created by: varungandhi-src

This code is deliberately missing an entry for Go: (I initially thought it was a bug)

var schemeToExternalService = map[string]string{
	dependencies.JVMPackagesScheme:    extsvc.KindJVMPackages,
	dependencies.NpmPackagesScheme:    extsvc.KindNpmPackages,
	dependencies.RustPackagesScheme:   extsvc.KindRustPackages,
	dependencies.PythonPackagesScheme: extsvc.KindPythonPackages,
}

There is special logic when this map is using around empty maps for lsif-go, because Go modules are not fetched as distinct "packages" (unlike npm packages), they're natively Git repos.

@mrnugget pointed out that

It looks like we currently don’t auto-index (edit: auto-add & auto-index) go/ (in the package repo sense) packages. We only index Go dependencies if they exist as repositories in the instance. If we’d turn on auto-adding and auto-indexing for go/ package repos, then we would stop indexing Go-dependencies-as-repos (which is also a bit weird), if we don’t change how it works.

We need to better define what the expected behavior here ought to be and document the code to provide more context if we're deliberately doing something different compared to other package hosts.