Skip to content

Commit

Permalink
refactor: switch on type instead of using reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
lavafroth committed Jul 13, 2023
1 parent e75ad3d commit f9a1501
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions pkg/providers/urlscan/types.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package urlscan

import (
"reflect"
"strings"
)

Expand Down Expand Up @@ -29,12 +28,10 @@ type archivedPage struct {

func parseSort(sort []interface{}) string {
var sortParam []string
for i := 0; i < len(sort); i++ {
t := reflect.TypeOf(sort[i])
v := reflect.ValueOf(sort[i])
switch t.Kind() {
case reflect.String:
sortParam = append(sortParam, v.String())
for _, t := range sort {
switch t.(type) {
case string:
sortParam = append(sortParam, t.(string))
}
}
return strings.Join(sortParam, ",")
Expand Down

0 comments on commit f9a1501

Please sign in to comment.