Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

New feature for get realistic words according a context #156

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dhfherna
Copy link

Description
My solution consists in consuming an API that allows to query a list of words related to a context, for example, for the context of a pastry shop, we can receive the following result:
List: pastry, pastrycook, patissier,: bakeshop, confectionary, cakery, pastry chef, pastrymaker, pasteler, bakery, pastrymaking, boulangerie, croissanterie, bakehouse, cake shop, pieshop, doughnutery, baker's, paste
Or if you prefer, a single random word from this list: pastrymaker

Are you trying to fix an existing issue?

#143

Go Version

$ go version
go version go1.21.3 linux/amd64

Go Tests

$ go test
2023/10/30 11:27:12 Error while requesting https://loremflickr.com/300/200 : request failed
2023/10/30 11:27:13 Error while creating a temp file: temp file creation failed
2023/10/30 11:27:13 Error while requesting https://randomuser.me : request failed
2023/10/30 11:27:13 Error while creating a temp file: temp file creation failed
PASS
ok      github.com/jaswdr/faker 5.128s

@LordNoteworthy
Copy link

Hello @dhfherna

It is probably best not to make network calls to solve this problem.

Making API requests to a third party service can fail or behave unexpectedly.

@jaswdr
Copy link
Owner

jaswdr commented Nov 7, 2023

@dhfherna thank you for the PR, although as @LordNoteworthy unfortunately there are many problems that arise when using external services, to start, the machine running the code could not have access to the internet. There is also no guaranteed that the external service will be available, imagine that your code fail because of that, is definitely not a good experience to have. We have similar issues on transient failures in our own tests because we use external services to generate images (which I'm planning to remove in the future).

As alternative, can you move the logic and data to the file itself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants