Skip to content

Commit

Permalink
optimize(hz): middleware search method (#762)
Browse files Browse the repository at this point in the history
  • Loading branch information
FGYFFFF authored May 6, 2023
1 parent c8ffa58 commit 0d8b98b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/hz/generator/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,11 @@ func (pkgGen *HttpPackageGenerator) updateMiddlewareReg(router interface{}, midd
}

for _, mw := range middlewareList {
if bytes.Contains(file, []byte(mw)) {
mwName := mw + "Mw"
if pkgGen.SnakeStyleMiddleware {
mwName = mw + "_mw"
}
if bytes.Contains(file, []byte(mwName)) {
continue
}
middlewareSingleTpl := pkgGen.tpls[middlewareSingleTplName]
Expand Down

0 comments on commit 0d8b98b

Please sign in to comment.