Skip to content

Commit

Permalink
fix: Improve go samples formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-balitskyi committed Oct 11, 2024
1 parent cfe3ca3 commit 35ed642
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/code-sample/go.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ export const createGoRequest = (
goPackageName,
requestStructName,
})
const goSdkRequestArgs = `context.Background()${isReqWithParams ? `, ${goPackageName}.${requestStructName}{${formattedArgs}}` : ''}`
const goSdkRequestArgs = `context.Background()${isReqWithParams ? `,\n${goPackageName}.${requestStructName}{\n${formattedArgs},\n}` : ''}`

const pathParts = request.path.split('/')

return `package main
${goSdkImports}
func main() {
client${pathParts.map((p) => pascalCase(p)).join('.')}(${goSdkRequestArgs})
client${pathParts.map((p) => pascalCase(p)).join('.')}(${isReqWithParams ? '\n' : ''}${goSdkRequestArgs},\n)
}
`.trim()
}
Expand Down Expand Up @@ -105,7 +105,7 @@ const formatGoRequestArgs = (
)
return `${pascalCase(paramKey)}: ${formattedValue}`
})
.join(', ')
.join(',\n\n')

const formatGoRequestArgValue = (
key: string,
Expand Down

0 comments on commit 35ed642

Please sign in to comment.