Closed adlandh closed 6 months ago
Hello. I'm using mac m1, go 1.22
This is my test:
func TestGofakeit(t *testing.T) { t.Run("v7", func(t *testing.T) { for i := 0; i < 10; i++ { t.Log(gofakeit.UUID()) } }) t.Run("v6", func(t *testing.T) { for i := 0; i < 10; i++ { t.Log(gofakeit6.UUID()) } }) }
first run: === RUN TestGofakeit === RUN TestGofakeit/v7 main_test.go:13: 8afddb57-fbd2-41e2-a929-898e6ffdf90c main_test.go:13: 4e692e8f-0f35-4d17-8c2d-9e21a0a27d8c main_test.go:13: 178a0b19-23bc-4d18-8f41-6b3332245600 main_test.go:13: ee10c86c-8fb3-4078-a11d-74ab31a029cd main_test.go:13: 15fb0693-3150-462b-85ec-d93dc1ed6225 main_test.go:13: a0de6e8f-582a-4a67-8c79-a4e014e07249 main_test.go:13: d7945ce3-a41f-4bdc-86f0-11d1f5fb2ef5 main_test.go:13: d571c628-233e-4988-8835-81d42638912a main_test.go:13: ebe4d910-19f8-438c-8d36-74414e605c02 main_test.go:13: 250b3469-879c-4cd7-8f41-d2334dd1573e === RUN TestGofakeit/v6 main_test.go:19: 3406f23f-9e95-49ca-b7d9-3bf896480fcb main_test.go:19: a6625de2-4222-470e-8e99-8d1645f87c44 main_test.go:19: 4ea2a069-d9ba-4d0c-89c0-49e9725bca49 main_test.go:19: 4bb05670-9758-425c-9d71-9b97023ddd77 main_test.go:19: 7c732da3-d2fd-457c-a456-ab4f1c8c2517 main_test.go:19: f4ee5b04-1dfa-465f-a168-af794245405a main_test.go:19: 09e4038a-da29-4d97-9726-bfa52041f255 main_test.go:19: 5cc820fa-8884-4440-89a2-22b36b9d2dc4 main_test.go:19: 3615c77f-cdfd-4ad1-98e0-82726dfe3237 main_test.go:19: 994bbfd2-77d9-414f-8a20-9c9df03e03eb
Second run: === RUN TestGofakeit === RUN TestGofakeit/v7 main_test.go:13: 8afddb57-fbd2-41e2-a929-898e6ffdf90c main_test.go:13: 4e692e8f-0f35-4d17-8c2d-9e21a0a27d8c main_test.go:13: 178a0b19-23bc-4d18-8f41-6b3332245600 main_test.go:13: ee10c86c-8fb3-4078-a11d-74ab31a029cd main_test.go:13: 15fb0693-3150-462b-85ec-d93dc1ed6225 main_test.go:13: a0de6e8f-582a-4a67-8c79-a4e014e07249 main_test.go:13: d7945ce3-a41f-4bdc-86f0-11d1f5fb2ef5 main_test.go:13: d571c628-233e-4988-8835-81d42638912a main_test.go:13: ebe4d910-19f8-438c-8d36-74414e605c02 main_test.go:13: 250b3469-879c-4cd7-8f41-d2334dd1573e === RUN TestGofakeit/v6 main_test.go:19: 9f58d13d-dcf2-4469-95f5-1072037c6ade main_test.go:19: 817ea0eb-b0ba-49c6-9fab-ad33626931b8 main_test.go:19: 26592d29-0169-4a0f-818a-b5f7c77301cb main_test.go:19: b54015a6-f4b3-49f1-9bbc-9043bf7be02c main_test.go:19: 2358dfc9-e46f-4bdb-a73e-e5a4ed825368 main_test.go:19: c88f3f1c-22bc-44a2-8881-3d2ed3344560 main_test.go:19: bd94e86b-d347-4ffd-a4c5-7f1fcedc0752 main_test.go:19: 5f5cd095-8601-4080-88b6-97f1e1f0a96c main_test.go:19: 8e02bd49-ec1c-4e0a-a8ef-4fb2dd6bdf81 main_test.go:19: 52517258-9e63-40d1-874c-39b88e40f7d2
Third run: === RUN TestGofakeit === RUN TestGofakeit/v7 main_test.go:13: 8afddb57-fbd2-41e2-a929-898e6ffdf90c main_test.go:13: 4e692e8f-0f35-4d17-8c2d-9e21a0a27d8c main_test.go:13: 178a0b19-23bc-4d18-8f41-6b3332245600 main_test.go:13: ee10c86c-8fb3-4078-a11d-74ab31a029cd main_test.go:13: 15fb0693-3150-462b-85ec-d93dc1ed6225 main_test.go:13: a0de6e8f-582a-4a67-8c79-a4e014e07249 main_test.go:13: d7945ce3-a41f-4bdc-86f0-11d1f5fb2ef5 main_test.go:13: d571c628-233e-4988-8835-81d42638912a main_test.go:13: ebe4d910-19f8-438c-8d36-74414e605c02 main_test.go:13: 250b3469-879c-4cd7-8f41-d2334dd1573e === RUN TestGofakeit/v6 main_test.go:19: cc0ef7e4-a689-477e-a3ba-031501ad9850 main_test.go:19: c29de588-67a1-4b0a-80dd-83900a98da8d main_test.go:19: f6096d77-9106-43a9-b438-784df116b7bd main_test.go:19: 7ff46bf1-036c-4b9a-9eae-50b128632952 main_test.go:19: 5de6ad69-224c-4907-b43b-22691daca122 main_test.go:19: a7d117ed-0040-4d79-b2e7-4e189eb52711 main_test.go:19: e5793844-ddc3-4519-b2fd-d417192c884f main_test.go:19: d86719e1-076e-4661-bb9b-a3b8618fe994 main_test.go:19: 7a457cb4-8996-497c-bd73-a818fbdc3789 main_test.go:19: 3d59d92c-0fbc-4036-8282-f088ce31cfc6
As you can see UUIDs, generated by v7 are always the same, but UUIDs of v6 are really randomly generated. Using gofakeit.Seed(0) can fix the issue.
ooo good catch let me double check my default generation of global
fixed v7.0.2
Thanks a lot!
no thank you. all the tests i have i cant have one that tests the initial seed of New(0) is random
Hello. I'm using mac m1, go 1.22
This is my test:
first run: === RUN TestGofakeit === RUN TestGofakeit/v7 main_test.go:13: 8afddb57-fbd2-41e2-a929-898e6ffdf90c main_test.go:13: 4e692e8f-0f35-4d17-8c2d-9e21a0a27d8c main_test.go:13: 178a0b19-23bc-4d18-8f41-6b3332245600 main_test.go:13: ee10c86c-8fb3-4078-a11d-74ab31a029cd main_test.go:13: 15fb0693-3150-462b-85ec-d93dc1ed6225 main_test.go:13: a0de6e8f-582a-4a67-8c79-a4e014e07249 main_test.go:13: d7945ce3-a41f-4bdc-86f0-11d1f5fb2ef5 main_test.go:13: d571c628-233e-4988-8835-81d42638912a main_test.go:13: ebe4d910-19f8-438c-8d36-74414e605c02 main_test.go:13: 250b3469-879c-4cd7-8f41-d2334dd1573e === RUN TestGofakeit/v6 main_test.go:19: 3406f23f-9e95-49ca-b7d9-3bf896480fcb main_test.go:19: a6625de2-4222-470e-8e99-8d1645f87c44 main_test.go:19: 4ea2a069-d9ba-4d0c-89c0-49e9725bca49 main_test.go:19: 4bb05670-9758-425c-9d71-9b97023ddd77 main_test.go:19: 7c732da3-d2fd-457c-a456-ab4f1c8c2517 main_test.go:19: f4ee5b04-1dfa-465f-a168-af794245405a main_test.go:19: 09e4038a-da29-4d97-9726-bfa52041f255 main_test.go:19: 5cc820fa-8884-4440-89a2-22b36b9d2dc4 main_test.go:19: 3615c77f-cdfd-4ad1-98e0-82726dfe3237 main_test.go:19: 994bbfd2-77d9-414f-8a20-9c9df03e03eb
Second run: === RUN TestGofakeit === RUN TestGofakeit/v7 main_test.go:13: 8afddb57-fbd2-41e2-a929-898e6ffdf90c main_test.go:13: 4e692e8f-0f35-4d17-8c2d-9e21a0a27d8c main_test.go:13: 178a0b19-23bc-4d18-8f41-6b3332245600 main_test.go:13: ee10c86c-8fb3-4078-a11d-74ab31a029cd main_test.go:13: 15fb0693-3150-462b-85ec-d93dc1ed6225 main_test.go:13: a0de6e8f-582a-4a67-8c79-a4e014e07249 main_test.go:13: d7945ce3-a41f-4bdc-86f0-11d1f5fb2ef5 main_test.go:13: d571c628-233e-4988-8835-81d42638912a main_test.go:13: ebe4d910-19f8-438c-8d36-74414e605c02 main_test.go:13: 250b3469-879c-4cd7-8f41-d2334dd1573e === RUN TestGofakeit/v6 main_test.go:19: 9f58d13d-dcf2-4469-95f5-1072037c6ade main_test.go:19: 817ea0eb-b0ba-49c6-9fab-ad33626931b8 main_test.go:19: 26592d29-0169-4a0f-818a-b5f7c77301cb main_test.go:19: b54015a6-f4b3-49f1-9bbc-9043bf7be02c main_test.go:19: 2358dfc9-e46f-4bdb-a73e-e5a4ed825368 main_test.go:19: c88f3f1c-22bc-44a2-8881-3d2ed3344560 main_test.go:19: bd94e86b-d347-4ffd-a4c5-7f1fcedc0752 main_test.go:19: 5f5cd095-8601-4080-88b6-97f1e1f0a96c main_test.go:19: 8e02bd49-ec1c-4e0a-a8ef-4fb2dd6bdf81 main_test.go:19: 52517258-9e63-40d1-874c-39b88e40f7d2
Third run: === RUN TestGofakeit === RUN TestGofakeit/v7 main_test.go:13: 8afddb57-fbd2-41e2-a929-898e6ffdf90c main_test.go:13: 4e692e8f-0f35-4d17-8c2d-9e21a0a27d8c main_test.go:13: 178a0b19-23bc-4d18-8f41-6b3332245600 main_test.go:13: ee10c86c-8fb3-4078-a11d-74ab31a029cd main_test.go:13: 15fb0693-3150-462b-85ec-d93dc1ed6225 main_test.go:13: a0de6e8f-582a-4a67-8c79-a4e014e07249 main_test.go:13: d7945ce3-a41f-4bdc-86f0-11d1f5fb2ef5 main_test.go:13: d571c628-233e-4988-8835-81d42638912a main_test.go:13: ebe4d910-19f8-438c-8d36-74414e605c02 main_test.go:13: 250b3469-879c-4cd7-8f41-d2334dd1573e === RUN TestGofakeit/v6 main_test.go:19: cc0ef7e4-a689-477e-a3ba-031501ad9850 main_test.go:19: c29de588-67a1-4b0a-80dd-83900a98da8d main_test.go:19: f6096d77-9106-43a9-b438-784df116b7bd main_test.go:19: 7ff46bf1-036c-4b9a-9eae-50b128632952 main_test.go:19: 5de6ad69-224c-4907-b43b-22691daca122 main_test.go:19: a7d117ed-0040-4d79-b2e7-4e189eb52711 main_test.go:19: e5793844-ddc3-4519-b2fd-d417192c884f main_test.go:19: d86719e1-076e-4661-bb9b-a3b8618fe994 main_test.go:19: 7a457cb4-8996-497c-bd73-a818fbdc3789 main_test.go:19: 3d59d92c-0fbc-4036-8282-f088ce31cfc6
As you can see UUIDs, generated by v7 are always the same, but UUIDs of v6 are really randomly generated. Using gofakeit.Seed(0) can fix the issue.