MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / ValidateInstallPlan

Function ValidateInstallPlan

internal/pluginstore/registry.go:281–301  ·  view source on GitHub ↗
(plan InstallPlan)

Source from the content-addressed store, hash-verified

279}
280
281func ValidateInstallPlan(plan InstallPlan) error {
282 plan = NormalizeInstallPlan(plan)
283 if plan.Type == "" {
284 return fmt.Errorf("missing install type")
285 }
286 if plan.Type != InstallTypeDirect && plan.Type != InstallTypeGitHubRelease {
287 return fmt.Errorf("unsupported install type %q", plan.Type)
288 }
289 if plan.Type != InstallTypeDirect {
290 return nil
291 }
292 if len(plan.Artifacts) == 0 {
293 return fmt.Errorf("direct install requires at least one artifact")
294 }
295 for index, artifact := range plan.Artifacts {
296 if errArtifact := ValidateArtifact(artifact); errArtifact != nil {
297 return fmt.Errorf("artifacts[%d]: %w", index, errArtifact)
298 }
299 }
300 return nil
301}
302
303func ValidateArtifact(artifact Artifact) error {
304 artifact.GOOS = normalizeGOOS(artifact.GOOS)

Callers 5

InstallDirectMethod · 0.85
directPluginVersionFunction · 0.85
ValidateMethod · 0.85
ValidatePluginFunction · 0.85
ValidatePluginVersionsFunction · 0.85

Calls 2

NormalizeInstallPlanFunction · 0.85
ValidateArtifactFunction · 0.85

Tested by

no test coverage detected