From d40dbfa3add787a385b423939831095674e79a62 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Mon, 23 May 2016 12:19:19 +0200 Subject: [PATCH] Added missing vendored packages --- .../Luzifer/go_helpers/str/slice.go | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 vendor/github.com/Luzifer/go_helpers/str/slice.go diff --git a/vendor/github.com/Luzifer/go_helpers/str/slice.go b/vendor/github.com/Luzifer/go_helpers/str/slice.go new file mode 100644 index 0000000..f93af69 --- /dev/null +++ b/vendor/github.com/Luzifer/go_helpers/str/slice.go @@ -0,0 +1,21 @@ +package str + +// AppendIfMissing adds a string to a slice when it's not present yet +func AppendIfMissing(slice []string, s string) []string { + for _, e := range slice { + if e == s { + return slice + } + } + return append(slice, s) +} + +// StringInSlice checks for the existence of a string in the slice +func StringInSlice(a string, list []string) bool { + for _, b := range list { + if b == a { + return true + } + } + return false +}