dmgk / faker Goto Github PK
View Code? Open in Web Editor NEWA library for generating fake data such as names, addresses, and phone numbers.
License: MIT License
A library for generating fake data such as names, addresses, and phone numbers.
License: MIT License
In a project indirectly importing faker I'm getting
go: github.com/enodata/[email protected]: parsing go.mod: unexpected module path "syreclabs.com/go/faker"
when running some go mod commands, e.g. go mod why
.
Any idea what we can do to fix this?
I already use go get -u syreclabs.com/go/faker
to get faker repo , but when I use my code
package main
import (
"fmt"
"github.com/dmgk/faker"
"strings"
)
func main() {
var phrases []string
for i := 1; i < 3; i++ {
phrases = append(phrases, faker.Hacker().Phrases()...)
}
fmt.Println(strings.Join(phrases[:], "; "))
}
~
I build it , but it says "lolcat.go:5:2: code in directory /root/go/src/github.com/dmgk/faker expects import "syreclabs.com/go/faker""
Currently there's no way to ensure unique values:
https://github.com/stympy/faker#ensuring-unique-values
Use case for me is in this project:
https://github.com/mpchadwick/dbanon
I generate random email addresses, but I need to ensure they're unique to prevent a duplicate key issue.
stympy/faker allows supports deterministic random by allowing you to seed:
This can be useful for example for testing.
Please make a new tag v2.0.0
– there is a problem with dependency management after GitHub repository was moved (or GitHub account renamed?), and then import path was changed again: fc813ba, v1.0.0...master
Also please add canonical import path to make those problems visible and not subtle.
I squatted https://github.com/enodata to prevent anyone from creating https://github.com/enodata/faker and see the world burn.
Hi,
The certificate used for the vanity URL syreclabs.com/go/faker
doesn't seem to be correctly setup.
$ go mod download
go: finding github.com/go-stack/stack v1.8.0
go: finding github.com/Microsoft/go-winio v0.4.14
go: finding github.com/go-kit/kit v0.9.0
#... more fetches
go: syreclabs.com/go/[email protected]: unrecognized import path "syreclabs.com/go/faker" (https fetch: Get https://syreclabs.com/go/faker?go-get=1: x509: certificate signed by unknown authority)
# ... more fetches
go: error loading module requirements
##[error]Process completed with exit code 1.
That's close to the issue #10, but the error message is a different one. That breaks fetching of dependencies from any go project that doesn't use vendored dependencies (so any library project using this faker library).
What I'm really missing here is the gender for things like Name()
.
Male
Female
Neutral
Why does your fake number generator return a string?
I would imaging that most cases were someone would want a fake number they want a number and not a string, and if they needed a string it is easy enough to convert it.
-> vgo get -v syreclabs.com/go/faker/v2
Fetching https://syreclabs.com/go/faker/v2?go-get=1
Parsing meta tags from https://syreclabs.com/go/faker/v2?go-get=1 (status code 200)
get "syreclabs.com/go/faker/v2": found meta tag get.metaImport{Prefix:"syreclabs.com/go/faker", VCS:"git", RepoRoot:"https://syreclabs.com/go/faker.git"} at https://syreclabs.com/go/faker/v2?go-get=1
get "syreclabs.com/go/faker/v2": verifying non-authoritative meta tag
Fetching https://syreclabs.com/go/faker?go-get=1
Parsing meta tags from https://syreclabs.com/go/faker?go-get=1 (status code 200)
go: syreclabs.com/go/faker/[email protected]: go.mod has non-.../v2 module path "syreclabs.com/go/faker" (and .../v2/go.mod does not exist) at revision v2.0.1
go: error loading module requirements
https://github.com/dmgk/faker/blob/master/go.mod should contain
module "syreclabs.com/go/faker/v2"
More info: https://github.com/golang/go/wiki/Modules#new-concepts
Is it the syreclabs.com/go/faker
repo?
go get syreclabs.com/go/faker:
package syreclabs.com/go/faker: unrecognized import path "syreclabs.com/go/faker" (https fetch: Get https://syreclabs.com/go/faker?go-get=1: x509: certificate has expired or is not yet valid)
git clone :
fatal: unable to access 'http://syreclabs.com/go/faker/': SSL certificate problem: certificate has expired
The instructions at https://pkg.go.dev/syreclabs.com/go/faker may need to get updated or certificate renewed
The certificate, serial number 04:30:70:e1:06:dc:cd:cc:74:60:8c:73:cc:25:e7:5a:a0:94
expired Friday, February 24, 2023 at 12:39:43 AM
Get "https://syreclabs.com/go/faker?go-get=1": x509: “syreclabs.com” certificate is expired
Unlike https://github.com/manveru/faker, this package is thread-safe, which is great. But this done at the expense of it changing a global state. Specifically, it seeds the global source.
One way to resolve this issue is to explicitly document that fact.
Another way is to use a private source with locks.
Something like that https://faker.readthedocs.io/en/stable/providers/faker.providers.user_agent.html
As a developer I want to get a Randoom bolean to generate fake bool randoom data
When running tests which use this package with the race detector it finds out there are data races.
Trivial to reproduce example is with the following useless program:
package main
import "syreclabs.com/go/faker"
func main() {
go faker.RandomString(10)
go faker.RandomString(10)
}
When I run it with go run -race
this is the output from go's race detector:
==================
WARNING: DATA RACE
Read at 0x00c42018afb8 by goroutine 7:
math/rand.read()
/usr/lib/go/src/math/rand/rand.go:265 +0x3c
math/rand.(*Rand).Read()
/usr/lib/go/src/math/rand/rand.go:261 +0x16d
syreclabs.com/go/faker.RandomString()
/home/kiril/go/src/syreclabs.com/go/faker/faker.go:90 +0xb2
Previous write at 0x00c42018afb8 by goroutine 6:
math/rand.read()
/usr/lib/go/src/math/rand/rand.go:276 +0xee
math/rand.(*Rand).Read()
/usr/lib/go/src/math/rand/rand.go:261 +0x16d
syreclabs.com/go/faker.RandomString()
/home/kiril/go/src/syreclabs.com/go/faker/faker.go:90 +0xb2
Goroutine 7 (running) created at:
main.main()
/tmp/fake.go:7 +0x6c
Goroutine 6 (finished) created at:
main.main()
/tmp/fake.go:6 +0x4b
==================
==================
WARNING: DATA RACE
Read at 0x00c42018afb0 by goroutine 7:
math/rand.read()
/usr/lib/go/src/math/rand/rand.go:266 +0x56
math/rand.(*Rand).Read()
/usr/lib/go/src/math/rand/rand.go:261 +0x16d
syreclabs.com/go/faker.RandomString()
/home/kiril/go/src/syreclabs.com/go/faker/faker.go:90 +0xb2
Previous write at 0x00c42018afb0 by goroutine 6:
math/rand.read()
/usr/lib/go/src/math/rand/rand.go:277 +0x108
math/rand.(*Rand).Read()
/usr/lib/go/src/math/rand/rand.go:261 +0x16d
syreclabs.com/go/faker.RandomString()
/home/kiril/go/src/syreclabs.com/go/faker/faker.go:90 +0xb2
Goroutine 7 (running) created at:
main.main()
/tmp/fake.go:7 +0x6c
Goroutine 6 (finished) created at:
main.main()
/tmp/fake.go:6 +0x4b
==================
Found 2 data race(s)
exit status 66
Now, this makes a lot of sense, since math/rand.Rand.Read
is documented as not safe to be called concurrently. Which is okay for a method of type. RandomString
in this package however is a global function and this issue could not be worked around as easily as with Rand.Read
. For instance math/rand.Read
(the global function) is safe to be called concurrently.
Thank you for adding a deterministic seed in #13! An issue I'm experiencing in https://github.com/humanmade/go-anonymize-mysqldump is the determinism seems to only last for a day. What I'm seeing is that whenever I go to work on the script a day or so later, the values generated are different than the ones generated a few days prior, even though the seed value hasn't changed. Any ideas?
Hello,
While working with datacharmer's test_db (https://github.com/datacharmer/test_db) and faker, I observed that we can also add a randomly generated gender field to the Name() class. I'm creating this issue to submit a PR against. Will do that soon.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.