Skip to content

Instantly share code, notes, and snippets.

@shiopon01
Created February 7, 2020 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shiopon01/9fc3bce0b027c6079653023cda71ae28 to your computer and use it in GitHub Desktop.
Save shiopon01/9fc3bce0b027c6079653023cda71ae28 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
type Hoges []struct {
value string
}
func (h *Hoges) Filter(item string) bool {
for i := 0; i < len(*h); i++ {
if (*h)[i].value == item {
return true
}
}
return false
}
func main() {
sample := Hoges{{"a"}, {"b"}, {"c"}}
fmt.Println(sample.Filter("c"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment