Ensure we always have a valid Cid by hiding the type in a struct.

This commit is contained in:
Kevin Atkinson
2018-08-25 03:15:22 -04:00
parent b5a08dcaaa
commit cad52160a4
2 changed files with 14 additions and 13 deletions

2
set.go
View File

@@ -56,7 +56,7 @@ func (s *Set) Visit(c Cid) bool {
// Cid in the set.
func (s *Set) ForEach(f func(c Cid) error) error {
for cs := range s.set {
c, _ := Cast([]byte(cs))
c, _ := Cast(cs.Bytes())
err := f(c)
if err != nil {
return err