gorhill / cronexpr

Cron expression parser in Go language (golang)
683 stars 168 forks source link

doesnt work in parallel usage (multiple goroutines) #26

Closed rhaps107 closed 6 years ago

rhaps107 commented 7 years ago

In parsing, global package variable layoutRegexp is changing. It is map, so usage in multiple gorountines causes map concurrent write error.

gorhill commented 7 years ago

Is there a written rule out there that all packages must be concurrency-safe?

s7v7nislands commented 7 years ago

so when using this package, I can't using goroutine?

hus787 commented 7 years ago

@gorhill I suppose so else Golang doesn't guarantee anything.

Ref: https://github.com/golang/go/issues/13446#issuecomment-161104226