Skip to content

Commit 390827e

Browse files
committed
fix bugs
1 parent f4df4dc commit 390827e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

orm/create_struct.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ func (q *Query[T]) CreateStruct(file ...string) error {
9898

9999
fileParts := strings.SplitN(fileContent, search, 2)
100100

101-
finalFileContent := fileParts[0] + search + "\n" + strings.Join(structLines, "\n") + "\n}\n" + oldStructRename + fileParts[1]
101+
finalFileContent := fileParts[0] + search + "\n" + strings.Join(structLines, "\n") + "\n}\n"
102+
103+
if len(fileParts) > 1 {
104+
finalFileContent += oldStructRename + fileParts[1]
105+
}
102106

103107
return ioutil.WriteFile(structFile, []byte(finalFileContent), 0644)
104108
}

0 commit comments

Comments
 (0)