Godeps/_workspace/src/gopkg.in/mgo.v2/session.go
func (iter *Iter) For(result interface{}, f func() error) (err error) {
	valid := false
	v := reflect.ValueOf(result)
	if v.Kind() == reflect.Ptr {
		v = v.Elem()
		switch v.Kind() {
		case reflect.Map, reflect.Ptr, reflect.Interface, reflect.Slice:
			valid = v.IsNil()
		}
	}
	if !valid {
		panic("For needs a pointer to nil reference value.  See the documentation.")
	}
	zero := reflect.Zero(v.Type())
	for {
		v.Set(zero)
		if !iter.Next(result) {
			break
		}
		err = f()
		if err != nil {
			return err
		}
	}
	return iter.Err()
}
func (iter *Iter) For(result interface{}, f func() error) (err error) {
	valid := false
	v := reflect.ValueOf(result)
	if v.Kind() == reflect.Ptr {
		v = v.Elem()
		switch v.Kind() {
		case reflect.Map, reflect.Ptr, reflect.Interface, reflect.Slice:
			valid = v.IsNil()
		}
	}
	if !valid {
		panic("For needs a pointer to nil reference value.  See the documentation.")
	}
	zero := reflect.Zero(v.Type())
	for {
		v.Set(zero)
		if !iter.Next(result) {
			break
		}
		err = f()
		if err != nil {
			return err
		}
	}
	return iter.Err()
}
func ( iter * Iter ) For ( result interface { } , f func ( ) error ) ( err error ) { valid := false v := reflect . ValueOf ( result ) if v . Kind ( ) == reflect . Ptr { v = v . Elem ( ) switch v . Kind ( ) { case reflect . Map , reflect . Ptr , reflect . Interface , reflect . Slice : valid = v . IsNil ( ) } } if ! valid { panic ( " " ) } zero := reflect . Zero ( v . Type ( ) ) for { v . Set ( zero ) if ! iter . Next ( result ) { break } err = f ( ) if err != nil { return err } } return iter . Err ( ) }
// The For method is obsolete and will be removed in a future release.
// See Iter as an elegant replacement.
The For method is obsolete and will be removed in a future release . See Iter as an elegant replacement .