Skip to content

Instantly share code, notes, and snippets.

View drekle's full-sized avatar

Derek Lemon drekle

  • Colorado Springs
View GitHub Profile
@drekle
drekle / gist:a44eb7c7b791699613550efffc220a05
Created August 24, 2018 17:40
Generic Slice Contains using reflection
--- misc.go
package utils
import "reflect"
func SliceContains(input interface{}, target interface{}) bool {
rValue := reflect.ValueOf(input)
rTarget := reflect.ValueOf(target)
if rValue.IsValid() {
for i := 0; i < rValue.Len(); i++ {

Keybase proof

I hereby claim:

  • I am drekle on github.
  • I am drekle (https://keybase.io/drekle) on keybase.
  • I have a public key whose fingerprint is F49F 0F9C D91E 48A1 49B8 E18E D009 A339 AF42 F9D1

To claim this, I am signing this object: