From 274283c7430e99bb672b60c8da3b9b5b36cfc6b3 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Wed, 26 Jun 2024 17:07:12 +0800 Subject: [PATCH] refactor: simplify AWS resource configuration using StringSlice - Simplify setting architectures by using `aws.StringSlice` - Simplify setting layers by using `aws.StringSlice` Signed-off-by: Bo-Yi Wu --- plugin.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/plugin.go b/plugin.go index 65c2457..2f8d743 100644 --- a/plugin.go +++ b/plugin.go @@ -147,11 +147,7 @@ func (p Plugin) Exec() error { //nolint:gocyclo // if len(p.Config.Architectures) != 0 { - var v []*string - for _, a := range p.Config.Architectures { - v = append(v, aws.String(a)) - } - input.SetArchitectures(v) + input.SetArchitectures(aws.StringSlice(p.Config.Architectures)) } if len(sources) != 0 { @@ -205,11 +201,7 @@ func (p Plugin) Exec() error { //nolint:gocyclo } if len(p.Config.Layers) > 0 { isUpdateConfig = true - var layers []*string - for _, v := range trimValues(p.Config.Layers) { - layers = append(layers, aws.String(v)) - } - cfg.SetLayers(layers) + cfg.SetLayers(aws.StringSlice(p.Config.Layers)) } envs := trimValues(p.Config.Environment)