mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
improve comment replacement regex pattern for command gen service (#2846)
This commit is contained in:
@ -194,7 +194,7 @@ func (c CGenService) Service(ctx context.Context, in CGenServiceInput) (out *CGe
|
||||
return nil, err
|
||||
}
|
||||
// remove all comments.
|
||||
fileContent, err = gregex.ReplaceString(`//(.*)|(?s)/\*(.*?)\*/`, "", fileContent)
|
||||
fileContent, err = gregex.ReplaceString(`(//.*)|((?s)/\*.*?\*/)`, "", fileContent)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ func (c CGenService) isToGenerateServiceGoFile(dstPackageName, filePath string,
|
||||
return true
|
||||
}
|
||||
// remove all comments.
|
||||
fileContent, err = gregex.ReplaceString(`/[/|\*](.*)`, "", fileContent)
|
||||
fileContent, err = gregex.ReplaceString(`(//.*)|((?s)/\*.*?\*/)`, "", fileContent)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user