mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-22 13:50:49 +01:00
Randomness apparently not good enough for windows. Tests were failing. This fix improves it
This commit is contained in:
parent
021e003e78
commit
5bf0c10525
2 changed files with 3 additions and 3 deletions
4
msg.go
4
msg.go
|
@ -360,9 +360,9 @@ func (m *Msg) SetMessageID() {
|
||||||
ct := time.Now().UnixNano()
|
ct := time.Now().UnixNano()
|
||||||
r := rand.New(rand.NewSource(ct))
|
r := rand.New(rand.NewSource(ct))
|
||||||
rn := r.Int63()
|
rn := r.Int63()
|
||||||
pid := os.Getpid()
|
pid := os.Getpid() * (r.Intn(10000) + 1)
|
||||||
cts := fmt.Sprintf("%d", ct)
|
cts := fmt.Sprintf("%d", ct)
|
||||||
mid := fmt.Sprintf("%d.%d.%s@%s", pid, rn, cts[:15], hn)
|
mid := fmt.Sprintf("%d.%d.%s@%s", pid, rn, cts[:16], hn)
|
||||||
m.SetMessageIDWithValue(mid)
|
m.SetMessageIDWithValue(mid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -710,7 +710,7 @@ func TestMsg_SetMessageIDRandomness(t *testing.T) {
|
||||||
}
|
}
|
||||||
for k, v := range c {
|
for k, v := range c {
|
||||||
if v > 1 {
|
if v > 1 {
|
||||||
t.Errorf("MessageID randomness not give. MessageID %q was generated %d times", k, v)
|
t.Errorf("MessageID randomness not given. MessageID %q was generated %d times", k, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue