From 888433a59dd1c7fedc497784a94da89b02d336db Mon Sep 17 00:00:00 2001 From: Emily McMullan Date: Mon, 27 Nov 2023 14:17:55 -0500 Subject: [PATCH] Allow source only analysis (#126) * allow source only analysis Signed-off-by: Emily McMullan * update dep test output Signed-off-by: Emily McMullan --------- Signed-off-by: Emily McMullan --- cmd/analyze.go | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/cmd/analyze.go b/cmd/analyze.go index c857f6f..ef8fa14 100644 --- a/cmd/analyze.go +++ b/cmd/analyze.go @@ -414,22 +414,23 @@ func (a *analyzeCommand) getConfigVolumes() (map[string]string, error) { javaConfig.InitConfig[0].ProviderSpecificConfig["jvmMaxMem"] = Settings.JvmMaxMem } - provConfig := []provider.Config{ - { - Name: "go", - BinaryPath: "/usr/bin/generic-external-provider", - InitConfig: []provider.InitConfig{ - { - Location: otherProvsMountPath, - AnalysisMode: provider.AnalysisMode(a.mode), - ProviderSpecificConfig: map[string]interface{}{ - "name": "go", - "dependencyProviderPath": "/usr/bin/golang-dependency-provider", - provider.LspServerPathConfigKey: "/root/go/bin/gopls", - }, + goConfig := provider.Config{ + Name: "go", + BinaryPath: "/usr/bin/generic-external-provider", + InitConfig: []provider.InitConfig{ + { + Location: otherProvsMountPath, + AnalysisMode: provider.FullAnalysisMode, + ProviderSpecificConfig: map[string]interface{}{ + "name": "go", + "dependencyProviderPath": "/usr/bin/golang-dependency-provider", + provider.LspServerPathConfigKey: "/root/go/bin/gopls", }, }, }, + } + + provConfig := []provider.Config{ javaConfig, { Name: "builtin", @@ -441,6 +442,12 @@ func (a *analyzeCommand) getConfigVolumes() (map[string]string, error) { }, }, } + + // go provider only supports full analysis mode + if a.mode == string(provider.FullAnalysisMode) { + provConfig = append(provConfig, goConfig) + } + jsonData, err := json.MarshalIndent(&provConfig, "", " ") if err != nil { a.log.V(1).Error(err, "failed to marshal provider config")