Skip to content

Commit 0e30c85

Browse files
committed
fix(jzero): fix gen when has go.work files
1 parent cef2767 commit 0e30c85

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

cmd/jzero/internal/command/gen/genapi/patch_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ func UpdateImportedModule(f *ast.File, fset *token.FileSet, workDir, module stri
282282
imports := astutil.Imports(fset, f)
283283
for _, imp := range imports {
284284
for _, name := range imp {
285-
if strings.HasPrefix(name.Path.Value, "\""+rootPkg) {
285+
if strings.Contains(name.Path.Value, rootPkg) {
286286
unQuote, _ := strconv.Unquote(name.Path.Value)
287287
newImp := strings.Replace(unQuote, rootPkg, module, 1)
288288
astutil.RewriteImport(fset, f, unQuote, newImp)

cmd/jzero/internal/command/gen/genrpc/patch_logic.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func UpdateImportedModule(filepath, workDir, module string) error {
176176
imports := astutil.Imports(fset, f)
177177
for _, imp := range imports {
178178
for _, name := range imp {
179-
if strings.HasPrefix(name.Path.Value, "\""+rootPkg) {
179+
if strings.Contains(name.Path.Value, rootPkg) {
180180
unQuote, _ := strconv.Unquote(name.Path.Value)
181181
newImp := strings.Replace(unQuote, rootPkg, module, 1)
182182
astutil.RewriteImport(fset, f, unQuote, newImp)

0 commit comments

Comments
 (0)