zeromicro / go-zero

A cloud-native Go microservices framework with cli tool for productivity.
https://go-zero.dev
MIT License
29.34k stars 3.96k forks source link

goctl generate unit test code #4442

Open studyzy opened 3 weeks ago

studyzy commented 3 weeks ago

Need goctl api go generate unit test code at the same time.

UT for:

By default, disable this option, use -withtest true to enable. For example:

goctl api go --style go_zero -api example.api  -dir . -withtest true

generate files:

internal
├── config
│   └── config.go
├── handler
│   ├── login
│   │   ├── register_handler.go
│   │   └── register_handler_test.go
│   └── routes.go
├── logic
│   └── login
│       ├── register_logic.go
│       └── register_logic_test.go
├── svc
│   └── service_context.go
└── types
    └── types.go