Skip to content

Commit

Permalink
remove unused utilities (signalfx#3687)
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme authored and Samiur Arif committed Sep 25, 2023
1 parent 76ce2aa commit dcc4616
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 50 deletions.
26 changes: 0 additions & 26 deletions internal/signalfx-agent/pkg/utils/set.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
package utils

// UniqueStrings returns a slice with the unique set of strings from the input
func UniqueStrings(strings []string) []string {
unique := map[string]struct{}{}
for _, v := range strings {
unique[v] = struct{}{}
}

keys := make([]string, 0)
for k := range unique {
keys = append(keys, k)
}

return keys
}

// StringSliceToMap converts a slice of strings into a map with keys from the slice
func StringSliceToMap(strings []string) map[string]bool {
// Use bool so that the user can do `if setMap[key] { ... }``
Expand All @@ -37,17 +22,6 @@ func StringSetToSlice(set map[string]bool) []string {
return out
}

// MergeStringSets merges 2+ string map sets into a single output map.
func MergeStringSets(sets ...map[string]bool) map[string]bool {
out := map[string]bool{}
for _, ss := range sets {
for k, v := range ss {
out[k] = v
}
}
return out
}

// StringSet creates a map set from vararg
func StringSet(strings ...string) map[string]bool {
return StringSliceToMap(strings)
Expand Down
24 changes: 0 additions & 24 deletions internal/signalfx-agent/pkg/utils/slice.go
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
package utils

// MakeRange creates an int slice containing all ints between `min` and `max`
func MakeRange(min, max int) []int {
a := make([]int, max-min+1)
for i := range a {
a[i] = min + i
}
return a
}

// InterfaceSliceToStringSlice returns a new slice that contains the elements
// of `is` as strings. Returns nil if any of the elements of `is` are not
// strings.
func InterfaceSliceToStringSlice(is []interface{}) []string {
var ss []string
for _, intf := range is {
if s, ok := intf.(string); ok {
ss = append(ss, s)
} else {
return nil
}
}
return ss
}

// RemoveAllElementsFromStringSlice removes all elements from toRemove that exists
// in inputStrings
func RemoveAllElementsFromStringSlice(inputStrings []string, toRemoveStrings []string) []string {
Expand Down

0 comments on commit dcc4616

Please sign in to comment.