(plan InstallPlan, goos string, goarch string)
| 9 | ) |
| 10 | |
| 11 | func 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 | |
| 26 | func (c Client) DownloadArtifact(ctx context.Context, artifact Artifact) ([]byte, error) { |
| 27 | artifact = NormalizeInstallPlan(InstallPlan{Type: InstallTypeDirect, Artifacts: []Artifact{artifact}}).Artifacts[0] |
no test coverage detected