Skip to content

Commit d1722c4

Browse files
committed
🐛 Fix go struct comment
1 parent 8b49294 commit d1722c4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/run.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,21 @@ function buildOpts(body, cliOpts) {
9595
return opts
9696
}
9797

98-
function buildContent(struct, path, comment) {
98+
function buildContent(go, path, comment) {
9999
let content = `// Code generated by api-to-go (https://github.com/nkmr-jp/api-to-go).\n\n`
100100
content += `package ${path.pkg}\n\n`
101-
if (struct.indexOf('time.') !== -1) {
101+
if (go.indexOf('time.') !== -1) {
102102
content += `${content}import "time"\n\n`
103103
}
104+
105+
content += `// ${go.split(" ")[1]} is the go struct of api's payload.\n//`
104106
content += comment
105-
content += struct
107+
content += go
106108
return content
107109
}
108110

109111
function buildComment(url, path, method, res) {
110-
let comment = `// ${path.struct} is the go struct of api's payload.\n//`
112+
let comment = ""
111113
const cfg = loadConfig(url, configFile)
112114
if (cfg?.["docs"] !== undefined) {
113115
comment += `\n// Docs: ${cfg?.["docs"]}`

0 commit comments

Comments
 (0)