Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swag fmt conflict with go fmt #1381

Closed
Zxilly opened this issue Nov 12, 2022 · 1 comment
Closed

swag fmt conflict with go fmt #1381

Zxilly opened this issue Nov 12, 2022 · 1 comment

Comments

@Zxilly
Copy link
Contributor

Zxilly commented Nov 12, 2022

Describe the bug
For the same godoc string (from example/basic/api.go)

// GetStringByInt example
//
//	@Summary      Add a new pet to the store
//	@Description  get string by ID
//	@ID           get-string-by-int
//	@Accept       json
//	@Produce      json
//	@Param        some_id  path      int           true  "Some ID"
//	@Param        some_id  body      web.Pet       true  "Some ID"
//	@Success      200      {string}  string        "ok"
//	@Failure      400      {object}  web.APIError  "We need ID!!"
//	@Failure      404      {object}  web.APIError  "Can not find ID"
//	@Router       /testapi/get-string-by-int/{some_id} [get]

swag fmt will turn tab to 2 space.

// GetStringByInt example
//
//  @Summary      Add a new pet to the store
//  @Description  get string by ID
//  @ID           get-string-by-int
//  @Accept       json
//  @Produce      json
//  @Param        some_id  path      int           true  "Some ID"
//  @Param        some_id  body      web.Pet       true  "Some ID"
//  @Success      200      {string}  string        "ok"
//  @Failure      400      {object}  web.APIError  "We need ID!!"
//  @Failure      404      {object}  web.APIError  "Can not find ID"
//  @Router       /testapi/get-string-by-int/{some_id} [get]

and go fmt will turn it back.

Expected behavior
swag fmt should keep the same behavior as go fmt

Your swag version
eaed517

Your go version
go version go1.19.2 windows/amd64

This issue seems be introduced by #1364 and #1366

@sdghchj
Copy link
Member

sdghchj commented Nov 18, 2022

go1.17.x won't turn it back
I am going to try go1.19.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants