Skip to content

Commit

Permalink
chore: slice loop replace
Browse files Browse the repository at this point in the history
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
  • Loading branch information
testwill committed Oct 12, 2023
1 parent 683d51d commit 0847a6c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
4 changes: 1 addition & 3 deletions cmd/file.go
Expand Up @@ -148,9 +148,7 @@ var fileCmd = &cobra.Command{

ff, err := voltFile.ReadLinesOrLiteral(args[0])
_ = err
for _, target := range ff {
targets = append(targets, target)
}
targets = append(targets, ff...)

// Remove Deplicated value
targets = voltUtils.UniqueStringSlice(targets)
Expand Down
12 changes: 3 additions & 9 deletions lib/func.go
Expand Up @@ -67,9 +67,7 @@ func Initialize(target Target, options Options) model.Options {
OutputResponse: false,
}
if len(options.UniqParam) > 0 {
for _, v := range options.UniqParam {
newOptions.UniqParam = append(newOptions.UniqParam, v)
}
newOptions.UniqParam = append(newOptions.UniqParam, options.UniqParam...)
}
if target.Method != "" {
newOptions.Method = target.Method
Expand All @@ -78,9 +76,7 @@ func Initialize(target Target, options Options) model.Options {
newOptions.Cookie = options.Cookie
}
if len(options.Header) > 0 {
for _, v := range options.Header {
newOptions.Header = append(newOptions.Header, v)
}
newOptions.Header = append(newOptions.Header, options.Header...)
}
if options.BlindURL != "" {
newOptions.BlindURL = options.BlindURL
Expand All @@ -107,9 +103,7 @@ func Initialize(target Target, options Options) model.Options {
newOptions.IgnoreReturn = options.IgnoreReturn
}
if len(options.IgnoreParams) > 0 {
for _, v := range options.IgnoreParams {
newOptions.IgnoreParams = append(newOptions.IgnoreParams, v)
}
newOptions.IgnoreParams = append(newOptions.IgnoreParams, options.IgnoreParams...)
}
if options.Trigger != "" {
newOptions.Trigger = options.Trigger
Expand Down
4 changes: 1 addition & 3 deletions pkg/optimization/abstraction.go
Expand Up @@ -137,9 +137,7 @@ func FindIndexesInLine(text, key string, lineSize, pointing int) []int {
if pointer != -1 {
tempIndexes := FindIndexesInLine(text[pointer+1:], key, lineSize, pointer+pointing+1)
indexes = append(indexes, pointer+lineSize+pointing)
for _, v := range tempIndexes {
indexes = append(indexes, v)
}
indexes = append(indexes, tempIndexes...)
}
return indexes
}

0 comments on commit 0847a6c

Please sign in to comment.