Skip to content

goctl code generation problem #5441

@heyuanchao

Description

@heyuanchao

Describe the bug
跟着文档操作,执行命令goctl api go -api user.api -dir .报错:user.api 30:5 syntax error: expected '@handler' | '}', got '@server'

To Reproduce
goctl api go -api user.api -dir .

  1. The code is
syntax = "v1" type ( LoginReq { Username string `json:"username"` Password string `json:"password"` } LoginResp { Token string `json:"token"` } UserInfoReq { Id int64 `path:"id"` } UserInfoResp { Id int64 `json:"id"` Username string `json:"username"` Email string `json:"email"` } ) service user-api { @handler Login post /user/login (LoginReq) returns (LoginResp) } service user-api { @server ( jwt: Auth ) @handler GetUserInfo get /user/:id (UserInfoReq) returns (UserInfoResp) } 
  1. The error is
    Error: user.api 30:5 syntax error: expected '@handler' | '}', got '@server'
Image

Environments (please complete the following information):

  • OS: [Linux]
  • go-zero version [v1.10.0]
  • goctl version [1.9.2 linux/amd64]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions