Skip to content

Commit

Permalink
refactor: simplify AWS resource configuration using StringSlice
Browse files Browse the repository at this point in the history
- Simplify setting architectures by using `aws.StringSlice`
- Simplify setting layers by using `aws.StringSlice`

Signed-off-by: Bo-Yi Wu <[email protected]>
  • Loading branch information
appleboy committed Jun 26, 2024
1 parent 49c9789 commit 274283c
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 274283c

Please sign in to comment.