mirror of https://github.com/zhufuyi/sponge
fix: ignore creating file when empty
This commit is contained in:
parent
da3e2f3afa
commit
69aebc1f1f
|
@ -160,6 +160,9 @@ func main() {
|
|||
|
||||
func saveGinRouterFiles(f *protogen.File) error {
|
||||
ginRouterFileContent := router.GenerateFiles(f)
|
||||
if len(ginRouterFileContent) == 0 {
|
||||
return nil
|
||||
}
|
||||
if !bytes.Contains(ginRouterFileContent, []byte("errors.")) {
|
||||
ginRouterFileContent = bytes.Replace(ginRouterFileContent, []byte(`"errors"`), []byte(""), 1)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue