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

Incorrect tab in swag fmt causes godoc display error #1801

Open
skadiD opened this issue Apr 26, 2024 · 0 comments
Open

Incorrect tab in swag fmt causes godoc display error #1801

skadiD opened this issue Apr 26, 2024 · 0 comments

Comments

@skadiD
Copy link

skadiD commented Apr 26, 2024

Describe the bug
In both GoLand and VSCode, a misalignment occurs in the display due to the use of a tab space between the @tag and the content. If a space is used for separation, the display appears normal.

Screenshots
Now by swag fmt:

// ShowAccount godoc
//
//	@Summary		Show an account
//	@Description	get string by ID
//	@Tags			accounts
//	@Accept			json
//	@Produce		json
//	@Param			id	path		int	true	"Account ID"
//	@Success		200	{object}	model.Account
//
//	@Failure		400	{object}	fiber.Ctx
//
//	@Failure		404	{object}	httputil.HTTPError
//	@Failure		500	{object}	httputil.HTTPError
//	@Router			/accounts/{id} [get]

image
image

Expected behavior
The content should align correctly (space replace tab)

// ShowAccount godoc
//
//	@Summary        Show an account
//	@Description    get string by ID
//	@Tags           accounts
//	@Accept         json
//	@Produce        json
//	@Param          id	path		int	true	"Account ID"
//	@Success        200	{object}	model.Account
//
//	@Failure        400	{object}	fiber.Ctx
//
//	@Failure        404	{object}	httputil.HTTPError
//	@Failure        500	{object}	httputil.HTTPError
//	@Router         /accounts/{id} [get]

image

Your swag version
1.16.3

Your go version
1.22.0

Additional context
This problem seems to be related specifically to the use of tab spaces for separation in the code. The display appears normal when a regular space is used instead.
#1364 #1366

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

1 participant