Skip to content

Commit fa1274e

Browse files
authored
Merge pull request #502 from testwill/slice
chore: slice loop replace
2 parents 683d51d + 0847a6c commit fa1274e

3 files changed

Lines changed: 5 additions & 15 deletions

File tree

cmd/file.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ var fileCmd = &cobra.Command{
148148

149149
ff, err := voltFile.ReadLinesOrLiteral(args[0])
150150
_ = err
151-
for _, target := range ff {
152-
targets = append(targets, target)
153-
}
151+
targets = append(targets, ff...)
154152

155153
// Remove Deplicated value
156154
targets = voltUtils.UniqueStringSlice(targets)

lib/func.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ func Initialize(target Target, options Options) model.Options {
6767
OutputResponse: false,
6868
}
6969
if len(options.UniqParam) > 0 {
70-
for _, v := range options.UniqParam {
71-
newOptions.UniqParam = append(newOptions.UniqParam, v)
72-
}
70+
newOptions.UniqParam = append(newOptions.UniqParam, options.UniqParam...)
7371
}
7472
if target.Method != "" {
7573
newOptions.Method = target.Method
@@ -78,9 +76,7 @@ func Initialize(target Target, options Options) model.Options {
7876
newOptions.Cookie = options.Cookie
7977
}
8078
if len(options.Header) > 0 {
81-
for _, v := range options.Header {
82-
newOptions.Header = append(newOptions.Header, v)
83-
}
79+
newOptions.Header = append(newOptions.Header, options.Header...)
8480
}
8581
if options.BlindURL != "" {
8682
newOptions.BlindURL = options.BlindURL
@@ -107,9 +103,7 @@ func Initialize(target Target, options Options) model.Options {
107103
newOptions.IgnoreReturn = options.IgnoreReturn
108104
}
109105
if len(options.IgnoreParams) > 0 {
110-
for _, v := range options.IgnoreParams {
111-
newOptions.IgnoreParams = append(newOptions.IgnoreParams, v)
112-
}
106+
newOptions.IgnoreParams = append(newOptions.IgnoreParams, options.IgnoreParams...)
113107
}
114108
if options.Trigger != "" {
115109
newOptions.Trigger = options.Trigger

pkg/optimization/abstraction.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,7 @@ func FindIndexesInLine(text, key string, lineSize, pointing int) []int {
137137
if pointer != -1 {
138138
tempIndexes := FindIndexesInLine(text[pointer+1:], key, lineSize, pointer+pointing+1)
139139
indexes = append(indexes, pointer+lineSize+pointing)
140-
for _, v := range tempIndexes {
141-
indexes = append(indexes, v)
142-
}
140+
indexes = append(indexes, tempIndexes...)
143141
}
144142
return indexes
145143
}

0 commit comments

Comments
 (0)