Hacker News new | ask | show | jobs
Kolpa – A fake data generator for Go (github.com)
76 points by masit 3275 days ago
7 comments

There are libraries already out there that do 95% of what this library does. Below you can find projects that existed for 5 and 3 years, respectively.

https://godoc.org/github.com/icrowley/fake

https://godoc.org/github.com/manveru/faker

I am not sure what functionality this package provides differently, other than the localization support, which could have been easily proposed to existing libraries.

Main goal is to have a library that provides more than these libraries you mentioned provide. Datetime generation and User Agent generation are basic samples of this aim at this time. It would not be looking good if it wasn't providing most needed data types like Name and Address while providing other specific data. Thanks for the comment!
There are also other language libraries for this purpose. I used Elizabeth some time ago https://lk-geimfari.github.io/elizabeth/
Not to make light of your library, but what I'm really looking, and have found most useful, is a go version of Xeger (https://code.google.com/archive/p/xeger/)(regex backwards). Basically you define a regex and xeger generates random strings that match that pattern. There's a newer lib in java as well called generex (https://github.com/mifmif/Generex).

These plus some hand written factory girl like code work well for me in Java. There are similar libs for C#. This lower level abstraction works for many many business cases, not just, you know, business software.

ha. I had a repo I started a while back that I also called xeger that did exactly that: it reversed regex's. I thought the name was clever, but I guess not clever enough. Kudos to them for making something that works. I think I spent a few hours one night and did not get so far and have not revisited the idea in 2 or so years. Maybe I should look back into that...
We've written something similar for Java (except it's more generic, it can generate anything you want, and it can be made by certain rules, e.g. 100 users out of which 10 would be women born between 1970 and 1980): https://github.com/smartcat-labs/ranger
Interesting choice of supported data types! I mean how often are you struggling with generating a mock value for..Color..
This is just an uninformed hypothesis but I interpreted this as being an arbitrary starting point - the idea being that it would eventually be extended to virtually every/any class via PRs. The randomness of what's in there now seems to communicate that idea well.
Great name :)
love the name!
For those missing it - "kolpa" is slang in Turkish for a fake thing - widely applicable. It could be a con, or a fake person (a bullshitter), or just something that's a bad substitute for the original, like a "SQNY" brand walkman knockoff. Allegedly from the Italian "Colpo".
Also "colpa" in Italian means guilt.
...which is cognate to the English "culpable".
I used another one before but this one seems good too.