agiledragon / agiledragon/gomonkey

并发不安全范围

Open
#20 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.3k
Forks
192
Avg merge
1d 6h
Merged PRs (30d)
1

Description

如下代码,并发访问getMockTime(),有安全问题吗?想确认下,我测试没发现并发问题。

```
func init() {
gomonkey.ApplyFunc(time.Now, func() time.Time {
mockTime := int64(1588239281376264700)

sec := mockTime / 1000000000
nsec := mockTime % 1000000000
return time.Unix(sec, nsec)
})
}

func getMockTime() {
// output: 2020-04-30 17:34:41.3762647 +0800 CST
fmt.Println("mock time:", time.Now())
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.