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

Add examples for all go sdk operations #27

Merged
merged 3 commits into from
Feb 28, 2024

Conversation

nitishkumar71
Copy link
Member

@nitishkumar71 nitishkumar71 commented Feb 18, 2024

Description

Add examples for all go sdk operations

Motivation and Context

How Has This Been Tested?

All examples have been copied from the previous PRs test cases.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

Commits:

  • My commit message has a body and describe how this was tested and why it is required.
  • I have signed-off my commits with git commit -s for the Developer Certificate of Origin (DCO)

Code:

  • My code follows the code style of this project.
  • I have added tests to cover my changes.

Docs:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@alexellis
Copy link
Member

Hi @nitishkumar71 .. I'm wondering how people can run these examples? And how can we maintain them over time?

Can you add a README file?

Perhaps we can take inspiration from github-go, and create a folder for each example with a main.go?

https://github.com/google/go-github/tree/master/example

@nitishkumar71
Copy link
Member Author

Hi @nitishkumar71 .. I'm wondering how people can run these examples? And how can we maintain them over time?

Can you add a README file?

Perhaps we can take inspiration from github-go, and create a folder for each example with a main.go?

https://github.com/google/go-github/tree/master/example

Sounds good to me.

I will do it.

@nitishkumar71 nitishkumar71 marked this pull request as draft February 21, 2024 12:19
Signed-off-by: Nitishkumar Singh <[email protected]>
@alexellis
Copy link
Member

I like the new structure, just a suggestion:

	fns, err := client.GetFunctions(context.Background(), "openfaas-fn")
	if err != nil {
		fmt.Fprintf(os.Stderr, "Get Failed: %s\n", err)
		os.Exit(1)
	}

vs

	fns, err := client.GetFunctions(context.Background(), "openfaas-fn")
	if err != nil {
		log.Printf("Get Failed: %s", err)
	}

This ran further code when I didn't have a valid gateway, instead of exiting.

and fmt vs log

@nitishkumar71 nitishkumar71 marked this pull request as ready for review February 21, 2024 17:04
Signed-off-by: Nitishkumar Singh <[email protected]>
@nitishkumar71
Copy link
Member Author

I like the new structure, just a suggestion:

	fns, err := client.GetFunctions(context.Background(), "openfaas-fn")
	if err != nil {
		fmt.Fprintf(os.Stderr, "Get Failed: %s\n", err)
		os.Exit(1)
	}

vs

	fns, err := client.GetFunctions(context.Background(), "openfaas-fn")
	if err != nil {
		log.Printf("Get Failed: %s", err)
	}

This ran further code when I didn't have a valid gateway, instead of exiting.

and fmt vs log

feedback changes are done.

Copy link
Member

@alexellis alexellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@alexellis alexellis merged commit 6e40ab0 into openfaas:master Feb 28, 2024
1 check passed
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.

Add examples for all supported functionalities
2 participants