Added predicate function in Go for flexibility