zeromicro / go-zero

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

[dartgen] Add ability to customize format options for dartgen command #4412

Open fondoger opened 1 month ago

fondoger commented 1 month ago

Currently, when running goctl api dart ... to generate dart API files, the dart formatter will be triggered automatically. But it always uses the default configurations when formatting the dart files.

This PR adds a feature to allow users to override the default dart format parameters. So the formatted dart file obeys the lint rules of the existing dart project.

Before:

goctl api dart -api server.api -dir ../app/api

=> `dart format <dir>`

After:

goctl api dart -api server.api -dir ../app/api -format-args "--line-length=150"

=> `dart format <dir> --line-length=150`

The current behavior is not affected.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.04%. Comparing base (8690859) to head (a925e10). Report is 153 commits behind head on master.

Additional details and impacted files [see 255 files with indirect coverage changes](https://app.codecov.io/gh/zeromicro/go-zero/pull/4412/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zeromicro)