Skip to content

Commit

Permalink
Merge pull request #4706 from Wind0r/lint-pkg-slices
Browse files Browse the repository at this point in the history
Complete lint for pkg/slices
  • Loading branch information
otoolep committed Nov 9, 2015
2 parents de660b4 + d36a610 commit 3821872
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/slices/strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package slices

import "strings"

// Union combines two string sets
func Union(setA, setB []string, ignoreCase bool) []string {
for _, b := range setB {
if ignoreCase {
Expand All @@ -17,6 +18,7 @@ func Union(setA, setB []string, ignoreCase bool) []string {
return setA
}

// Exists checks if a string is in a set
func Exists(set []string, find string) bool {
for _, s := range set {
if s == find {
Expand All @@ -26,6 +28,7 @@ func Exists(set []string, find string) bool {
return false
}

// ExistsIgnoreCase checks if a string is in a set but ignores its case
func ExistsIgnoreCase(set []string, find string) bool {
find = strings.ToLower(find)
for _, s := range set {
Expand Down

0 comments on commit 3821872

Please sign in to comment.