Skip to content

Commit

Permalink
Allow source only analysis (#126)
Browse files Browse the repository at this point in the history
* allow source only analysis

Signed-off-by: Emily McMullan <[email protected]>

* update dep test output

Signed-off-by: Emily McMullan <[email protected]>

---------

Signed-off-by: Emily McMullan <[email protected]>
  • Loading branch information
eemcmullan authored Nov 27, 2023
1 parent 8022770 commit 888433a
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions cmd/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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")
Expand Down

0 comments on commit 888433a

Please sign in to comment.