mirror of
https://github.com/goreleaser/nfpm
synced 2024-05-14 04:16:08 +02:00
fix: dont modify slices in a loop (#554)
This commit is contained in:
parent
a7a2df2794
commit
8a1b1fcc04
11
nfpm.go
11
nfpm.go
|
@ -149,18 +149,15 @@ func (c *Config) Validate() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func remove(slice []string, s int) []string {
|
||||
return append(slice[:s], slice[s+1:]...)
|
||||
}
|
||||
|
||||
func (c *Config) expandEnvVarsStringSlice(items []string) []string {
|
||||
for i, dep := range items {
|
||||
val := strings.TrimSpace(os.Expand(dep, c.envMappingFunc))
|
||||
items[i] = val
|
||||
}
|
||||
for i, val := range items {
|
||||
if val == "" {
|
||||
items = remove(items, i)
|
||||
for i := 0; i < len(items); i++ {
|
||||
if items[i] == "" {
|
||||
items = append(items[:i], items[i+1:]...)
|
||||
i-- // Since we just deleted items[i], we must redo that index
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -352,6 +352,8 @@ overrides:
|
|||
depends:
|
||||
- ${PKG}
|
||||
- package (= ${VERSION})
|
||||
- ${PKG}
|
||||
- ${PKG}
|
||||
rpm:
|
||||
depends:
|
||||
- package = ${VERSION}
|
||||
|
|
Loading…
Reference in New Issue