1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

refactor: improvements

This commit is contained in:
Carlos Alexandro Becker 2023-04-30 13:22:46 +00:00
parent b01f6ec14a
commit 7858e3ee1a
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
2 changed files with 18 additions and 8 deletions

View File

@ -77,7 +77,7 @@ func runAll(ctx *context.Context, cli client.Client) error {
return nil
}
func doRun(ctx *context.Context, krew config.Krew, cl client.Client) error {
func doRun(ctx *context.Context, krew config.Krew, cl client.ReleaserURLTemplater) error {
if krew.Name == "" {
return pipe.Skip("krew: manifest name is not set")
}
@ -177,7 +177,12 @@ func templateFields(ctx *context.Context, krew config.Krew) (config.Krew, error)
return krew, nil
}
func buildmanifest(ctx *context.Context, krew config.Krew, client client.Client, artifacts []*artifact.Artifact) (string, error) {
func buildmanifest(
ctx *context.Context,
krew config.Krew,
client client.ReleaserURLTemplater,
artifacts []*artifact.Artifact,
) (string, error) {
data, err := manifestFor(ctx, krew, client, artifacts)
if err != nil {
return "", err
@ -193,7 +198,12 @@ func doBuildManifest(data Manifest) (string, error) {
return string(out), nil
}
func manifestFor(ctx *context.Context, cfg config.Krew, cl client.Client, artifacts []*artifact.Artifact) (Manifest, error) {
func manifestFor(
ctx *context.Context,
cfg config.Krew,
cl client.ReleaserURLTemplater,
artifacts []*artifact.Artifact,
) (Manifest, error) {
result := Manifest{
APIVersion: apiVersion,
Kind: kind,

View File

@ -71,7 +71,7 @@ func (Pipe) Default(ctx *context.Context) error {
return nil
}
func doRun(ctx *context.Context, cl client.Client) error {
func doRun(ctx *context.Context, cl client.ReleaserURLTemplater) error {
scoop := ctx.Config.Scoop
archives := ctx.Artifacts.Filter(
@ -231,7 +231,7 @@ func doBuildManifest(manifest Manifest) (bytes.Buffer, error) {
return result, err
}
func dataFor(ctx *context.Context, cl client.Client, artifacts []*artifact.Artifact) (Manifest, error) {
func dataFor(ctx *context.Context, cl client.ReleaserURLTemplater, artifacts []*artifact.Artifact) (Manifest, error) {
manifest := Manifest{
Version: ctx.Version,
Architecture: map[string]Resource{},
@ -259,10 +259,10 @@ func dataFor(ctx *context.Context, cl client.Client, artifacts []*artifact.Artif
}
var arch string
switch {
case artifact.Goarch == "386":
switch artifact.Goarch {
case "386":
arch = "32bit"
case artifact.Goarch == "amd64":
case "amd64":
arch = "64bit"
default:
continue