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
Proposal: Update Go template to include an example that works out-of-the-box #839
Comments
I think this is being tracked here: #572 |
@zroubalik Is it ok to keep this as a sub-issue from #572 so we can use it to discuss the proposed example for Go only? |
Added a PR with a simple example.. follows the same approach as the |
The builtin Functions are not examples, per se, but it should probably be updated to echo the event received. The builtin Functions are intentionally not actual app examples, as they are intended to showcase the minimum necessary code to execute in order to verify functionality (an echo; such as for integration testing). They are also intended to pre-populate the user's new Function with a default function signature, in the language chosen, without leaving the user with a lot of code to delete before they can start on their own Function. For Example Functions, perhaps see the Function Examples templates repository, where any examples would be greatly appreciated. Given an example Function in the subdirectory
Other builtin templates for other languages which currently do more than the minimum echo were likely developed before Extensible Repositories was implemented (the command above), and they should now be moved to the Function Examples repository, leaving a simple echo with a test in this repository. |
The discussion in #606 has some background on the reasoning behind this decision that might help. The default Function should have no actual implementation other than to echo back the event received, so perhaps we can keep the more complex function signature which returns an even that you added in the referenced PR, but simply return the inbound All Function Templates, in all languages, should already work "out of the box" including compiling (where appropriate), test, deploy and echo when invoked (see |
@lkingland ok this is cool.. so I've created this repo to test: https://github.com/salaboy/func-templates Do you think if we create a repo |
@salaboy That looks good! And I think using an official set of examples to support docs is a good idea, yes. In fact that is exactly one of the use-cases in mind when adding the "extensible template repositories" feature! |
Following the Spring Boot template, which includes a working function and cloud events routing based on CE-Type or an expression, it will be great if the Go template includes some working examples following the same lines. We can apply the same example to other languages too.
The Go Template just include an empty Handle function, that by default uses a signature that doesn't return a CloudEvent after processing the request.
I will create a PR with a simple example following the Spring Boot template example.
The text was updated successfully, but these errors were encountered: