Jennifer88huang commented on a change in pull request #8005:
URL: https://github.com/apache/pulsar/pull/8005#discussion_r485525085
##########
File path: site2/docs/functions-package.md
##########
@@ -449,34 +360,30 @@ This example demonstrates how to package a function in Go.
}
```
- > **Tip**
- >
- > You can use context to connect with the Go function.
- >
- > ```
- > if fc, ok := pf.FromContext(ctx); ok {
- > fmt.Printf("function ID is:%s, ", fc.GetFuncID())
- > fmt.Printf("function version is:%s\n", fc.GetFuncVersion())
- > }
- > ```
-
- > **Note**
- >
- > - In `main()`, you **only** need to register the function name to
`Start()`. **Only** one function name can be received in `Start()`.
- >
- > - Go function uses Go reflection based on the received function name to
verify whether the parameter list and returned value list implemented are
correct. The parameter list and returned value list specified **must be** one
of the following sample functions:
- >
- > ```
- > func ()
- > func () error
- > func (input) error
- > func () (output, error)
- > func (input) (output, error)
- > func (context.Context) error
- > func (context.Context, input) error
- > func (context.Context) (output, error)
- > func (context.Context, input) (output, error)
- > ```
+ You can use context to connect to the Go function.
+
+ ```
+ if fc, ok := pf.FromContext(ctx); ok {
+ fmt.Printf("function ID is:%s, ", fc.GetFuncID())
+ fmt.Printf("function version is:%s\n", fc.GetFuncVersion())
+ }
+ ```
+
+ When writing a Go function, remember that
+ - In `main()`, you **only** need to register the function name to
`Start()`. **Only** one function name is received in `Start()`.
+ - Go function uses Go reflection based on the received function name to
verify whether the parameter list and returned value list implemented are
correct. The parameter list and returned value list specified **must be** one
of the following sample functions:
Review comment:
nice catch, I can simplify it, thanks for your reminder.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]