Allow library to be used in parallel

This PR allows concurrent calls to Parse. Further it makes the test be
part of the same package.

Fixes https://github.com/gorhill/cronexpr/issues/26
This commit is contained in:
Alex Dadgar
2017-09-15 11:30:32 -07:00
parent d520615e53
commit 675cac9b2d
3 changed files with 24 additions and 23 deletions

View File

@@ -8,15 +8,13 @@
*
*/
package cronexpr_test
package cronexpr
/******************************************************************************/
import (
"fmt"
"time"
"github.com/gorhill/cronexpr"
)
/******************************************************************************/
@@ -24,7 +22,7 @@ import (
// ExampleMustParse
func ExampleMustParse() {
t := time.Date(2013, time.August, 31, 0, 0, 0, 0, time.UTC)
nextTimes := cronexpr.MustParse("0 0 29 2 *").NextN(t, 5)
nextTimes := MustParse("0 0 29 2 *").NextN(t, 5)
for i := range nextTimes {
fmt.Println(nextTimes[i].Format(time.RFC1123))
// Output: