OpenAPITools / OpenAPITools/openapi-generator
[BUG][GO] generated go code not not formatted properly
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
-
- generated sample code in
./samples/client/petstore/go/
- generated sample code in
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
-
- branch master date 2019-10-02 commit c136b83bdb5e56ddb297de7f0d5bb9af447a9e54
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
-
- run go fmt on the generated code and view changes via git diff
- [Optional] Bounty to sponsor the fix (example)
Description
The generated code does not follow the go coding standards (go fmt)
openapi-generator version
commit c136b83bdb5e56ddb297de7f0d5bb9af447a9e54 (latest commit on master on 2019-10-02T15:27:00)
Steps to reproduce
cd ./samples/client/petstore/go
cd ./go-petstore
go fmt ./*
cd ../go-petstore-withXml
go fmt ./*
cd ../../../../server/petstore/go-gin-api-server
go fmt ./*
Suggest a fix
Correct all mustache templates and add a test for the build servers which runs "go fmt" and checks if there are any changed files. If yes, the test should fail.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in samples/client/petstore/go/ and server/petstore/go-gin-api-server, then run the listed go fmt commands and inspect the resulting git diff. Trace the generated output back to the Go mustache templates. Done means the generated samples require no formatting changes and a build-server test fails when go fmt would modify files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- testing-qa, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100