Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Docs for mock data generation give incorrect counts #196

Closed
tomihawk opened this issue Nov 13, 2022 · 1 comment · Fixed by #218
Closed

Docs for mock data generation give incorrect counts #196

tomihawk opened this issue Nov 13, 2022 · 1 comment · Fixed by #218
Labels
documentation Improvements or additions to documentation mock-api Relates to the `mock-api` feature.

Comments

@tomihawk
Copy link

The documentation at https://dev.twitch.tv/docs/cli/mock-api-command and https://github.com/twitchdev/twitch-cli/blob/main/docs/mock-api.md states that the twitch mock-api generate command will default to generate 10 users but it seems to default to 1. The first link also says that if you run twitch mock-api start without having generated any data it will generate the default 10, but it seems to generate 25 users.

The 25 users seems to come from

err := generate.Generate(25)
or
err := generate.Generate(25)

I'm guessing the 1 comes from the &count variable being referenced at

generateCmd.Flags().IntVarP(&count, "count", "c", 10, "Defines the number of fake users to generate.")
is not defined anywhere. I'm not a Go programmer so I'm not sure why the compiler would let you reference the memory address of an undefined variable but specifying a number with -c works fine.

@Xemdo Xemdo added documentation Improvements or additions to documentation mock-api Relates to the `mock-api` feature. labels Nov 18, 2022
@Xemdo
Copy link
Contributor

Xemdo commented Apr 1, 2023

Docs will stay at 10, but if the server is new it will generate 25. The generate command is to generate more users, with 10 was the default.

For it generating 1 instead of 10, this is because the count variable is referenced twice. First is here:, as you mentioned

generateCmd.Flags().IntVarP(&count, "count", "c", 10, "Defines the number of fake users to generate.")

And again at
triggerCmd.Flags().IntVarP(&count, "count", "c", 1, "Count of events to events. This will simulate a sub gift, or large number of cheers.")

The one in events.go must be executed second, because it overrides. I'll split these variables up to avoid any issues.

Xemdo added a commit that referenced this issue Apr 1, 2023
@Xemdo Xemdo mentioned this issue Apr 1, 2023
4 tasks
@Xemdo Xemdo closed this as completed in #218 Apr 1, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
documentation Improvements or additions to documentation mock-api Relates to the `mock-api` feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants