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

Formatting with multiple Services #61

Closed
Xytrical opened this issue Apr 4, 2024 · 1 comment
Closed

Formatting with multiple Services #61

Xytrical opened this issue Apr 4, 2024 · 1 comment
Assignees

Comments

@Xytrical
Copy link
Contributor

Xytrical commented Apr 4, 2024

As of #59, post formatting .ridl files using -fmt=true with multiple Services does not work anymore.

How to reproduce

Create a example.ridl file with the following contents:

webrpc = v1

name = example-api
version = v0.1.0

service ExampleService
  - Ping()
  - Status() => (status: bool)

service DummyService
  - Ping()
  - Status() => (status: bool)

Running the following command:

webrpc-gen -schema=./example.ridl -pkg=webrpc -server -out=./gen/webrpc/example.gen.go -target=golang

Will result in:

 format error       : failed to format generated Go source: 57:2: expected ';', found 'type'

Running the same command with version v0.14.1 works fine:

webrpc-gen -schema=./example.ridl -pkg=webrpc -server -out=./gen/webrpc/example.gen.go -target=github.com/webrpc/[email protected]

Fix

The issue is in line 60 of types.go.tmpl. Changing this:

{{- range $_, $method := $service.Methods -}}
{{ if eq $method.StreamOutput true }}

To this:

{{- range $_, $method := $service.Methods }}
{{ if eq $method.StreamOutput true -}}

Seems to fix the issue.

@pkieltyka
Copy link
Member

thx for the PR. I tagged v0.14.3

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

No branches or pull requests

3 participants