zenrpc
zenrpc copied to clipboard
Default value for string arguments with space
Setting default value for string parameters with space(s) causes generator error.
Example code:
// Echo returns input string.
//zenrpc:to="John Doe" name goes here
func (s *Say) Hello(to string) string {
return fmt.Sprintf("Hey, %v!", to)
}
What I got:
> go generate src/rpc/rpc.go
Generator version: 1.0.1
Entrypoint: rpc.go
Error: 85:23: string literal not terminated
As a work-around, you can use a constant like this:
const defaultHelloTo="John Doe"
// Echo returns input string.
//zenrpc:to=defaultHelloTo name goes here
func (s *Say) Hello(to string) string {
return fmt.Sprintf("Hey, %v!", to)
}