Coder Social home page Coder Social logo

golang-petname's People

Contributors

dustinkirkland avatar mwhudson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

golang-petname's Issues

Petname generation is not "random" unless rand.Seed is set

This is fairly obvious after taking a peek at the source and seeing the use of rand.Intn. That said I think it would be a good idea to add a note in the Readme about this and recommend setting the seed before generating any petnames using the library. If this is the case and I'm not missing something I'd be happy to spin up a PR.

Thanks for the library!

Randomness behaviour with go 1.20

You've got this function calling rand.Seed for a non deterministic mode.

func NonDeterministicMode() {

However, since go 1.20, rand is automatically seeded, unless explicitly disabled:

// Prior to Go 1.20, the generator was seeded like Seed(1) at program startup.
// To force the old behavior, call Seed(1) at program startup.
// Alternately, set GODEBUG=randautoseed=0 in the environment
// before making any calls to functions in this package.

Maybe you want to factor this behaviour in, not sure. For me personally, I called rand.Seed manually beforehand and simply had no change in behaviour. But for people expecting something deterministic, this might be confusing. Additionaly, this library might want to stop using globalrand and instead allow specifying a source, as this makes it easier to use within projects that use randomness for other purposes.

move init() from the shared package into the CLI

Hi,

We'd like to use your library to generate nonces but I'm concerned about the init() function that's included in petname.go. This init() will be called on startup and could conflict with other calls to rand.Seed().

In our case we have some code to alternate between a specific seed in order to repeat a test run and time.Now().UTC().UnixNano() for psuedo-random behavior.

Would you be open to simple PR to move the init() into https://github.com/dustinkirkland/golang-petname/blob/master/cmd/petname/main.go? This shouldn't affect the behavior of the petname utility but it will make it easier for us to reuse the library.

Thanks,
brian

Filter out potentially offensive combinations

This may be interesting and funny, but I have just actually received holy-crappie from a call to petname.Generate(2, "-"). It happened when using random_pet Terraform resource and now I have AWS resources tagged with that interesting name.
It's not a problem in a test scenario, but I'd prefer to avoid such nasty surprises in production. What do you think about adding a filter for forbidden combinations to the code? I'm not sure how long the "naughty" list would be, but it might be interesting to think about other possible examples.

Publish docker image

Hi,
Nice tool!

Would you be open to publishing a simple Docker image on Docker Hub for this?

Consider allow older versions of Go

For Incus (ex-LXD), we like supporting the past two major Go versions, that is, 1.20 and 1.21 currently.

Your recent change to introduce a go.mod came with you setting a minimal version of go 1.21.1 which is therefore breaking us.

I don't see any reason for petname to require 1.21.1, so you should be able to just go mod tidy --go=1.20 to set the base version to 1.20.

Please tag releases

Please tag releases of this library that correspond to the versions you list in debian/changelog. Doing so will greatly help individuals who are packaging this library and using something like a watchfile to track new releases.

(I'm working on updating Debian's version of this package, and due to a historical decision about the versioning of Debian's packaging, Debian's version is a mashup of <version>+<git commit>. Proper tagging would eliminate this less than ideal situation.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.