oklog / ulid

Universally Unique Lexicographically Sortable Identifier (ULID) in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Data race on MonotonicRead

gurre opened this issue · comments

I got some data race warnings when running go test -race on some code using this library.

Should the documentation be improved and do I need to use a mutex?

WARNING: DATA RACE
Read at 0x00c4200aa8a0 by goroutine 8:
.../github.com/oklog/ulid.(*monotonic).MonotonicRead()

Previous write at 0x00c4200aa8a0 by goroutine 10:
.../github.com/oklog/ulid.(*uint80).SetBytes()

Saw the docs now. Doh!

As per documentation, the returned io.Reader isn't safe for concurrent use: https://godoc.org/github.com/oklog/ulid#Monotonic