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

Function SelectArtifact

internal/pluginstore/direct.go:11–24  ·  view source on GitHub ↗
(plan InstallPlan, goos string, goarch string)

Source from the content-addressed store, hash-verified

9)
10
11func SelectArtifact(plan InstallPlan, goos string, goarch string) (Artifact, error) {
12 plan = NormalizeInstallPlan(plan)
13 goos = normalizeGOOS(goos)
14 goarch = normalizeGOARCH(goarch)
15 if plan.Type != InstallTypeDirect {
16 return Artifact{}, fmt.Errorf("install type %q is not direct", plan.Type)
17 }
18 for _, artifact := range plan.Artifacts {
19 if artifact.GOOS == goos && artifact.GOARCH == goarch {
20 return artifact, nil
21 }
22 }
23 return Artifact{}, fmt.Errorf("artifact not found for %s/%s", goos, goarch)
24}
25
26func (c Client) DownloadArtifact(ctx context.Context, artifact Artifact) ([]byte, error) {
27 artifact = NormalizeInstallPlan(InstallPlan{Type: InstallTypeDirect, Artifacts: []Artifact{artifact}}).Artifacts[0]

Callers 1

InstallDirectMethod · 0.85

Calls 3

NormalizeInstallPlanFunction · 0.85
normalizeGOOSFunction · 0.85
normalizeGOARCHFunction · 0.85

Tested by

no test coverage detected