# Distributed Services with Go - Method log.Read() fails reading Records

**URL:** <https://forum.devtalk.com/t/distributed-services-with-go-method-log-read-fails-reading-records/733>\
**Category:** PragProg Customers\
**Tags:** book-distributed-services-with-go, errata\
**Created:** [10 June 2020 07:14 UTC](https://forum.devtalk.com/t/distributed-services-with-go-method-log-read-fails-reading-records/733 "2020-06-10T07:14:46Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![travisjeffery](https://forum.devtalk.com/user_avatar/forum.devtalk.com/travisjeffery/32/525_2.png) [@travisjeffery](https://forum.devtalk.com/u/travisjeffery)\
**Post date:** [10 June 2020 10:25 UTC](https://forum.devtalk.com/t/distributed-services-with-go-method-log-read-fails-reading-records/733/2 "2020-06-10T10:25:43Z")

</div>

Hey, yeah it should be implemented like this:

```auto
func (l *Log) Read(off uint64) (*api.Record, error) {
	l.mu.RLock()
	defer l.mu.RUnlock()
	var s *segment
	for _, segment := range l.segments {
		if segment.baseOffset <= off && off < segment.nextOffset {
			s = segment
			break
		}
	}
	// START: before
	if s == nil || s.nextOffset <= off {
		return nil, fmt.Errorf("offset out of range: %d", off)
	}
	// END: before
	return s.Read(off)
}

```

I fixed a ton of issues that will be in the next beta, which should be out either late this week or next week.

---

_[View the full topic](https://forum.devtalk.com/t/distributed-services-with-go-method-log-read-fails-reading-records/733)._
