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

gofumpt re-formats tabs to spaces (was: New release built with go 1.19?) #254

Closed
morremeyer opened this issue Dec 19, 2022 · 3 comments
Closed

Comments

@morremeyer
Copy link

I propose to make a new release built with go 1.19.

go 1.19 improved support for documentation comments a lot, see https://tip.golang.org/doc/go1.19#go-doc.
Other tools, like swagger, have started to adopt this.

The behaviour of gofumpt depends on the go version it is built with (due to the use of go/printer from go - see #244 (comment) if you want to learn more.

gofumpt is starting to become incompatible with documentation comments using those new features as it formats them in a way that breaks the use of those new features.

I'll make a PR to bump the version in the next few days.

@mvdan
Copy link
Owner

mvdan commented Dec 20, 2022

What version bump do you mean? Note that the latest version, https://github.com/mvdan/gofumpt/releases/tag/v0.4.0, was already based on (and built with) Go 1.19.

The only quirk is #244. If someone builds gofumpt with Go 1.18, its behavior changes, as we depend on the standard library's go/printer formatting behavior. We'll fix that, but it's unrelated to "bumping" the Go version.

@morremeyer morremeyer changed the title New release built with go 1.19? gofumpt re-formats tabs to spaces (was: New release built with go 1.19?) Dec 20, 2022
@morremeyer
Copy link
Author

morremeyer commented Dec 20, 2022

I was looking at the go.mod go line and wrongly assumed this influenced anything.

I analyzed this further and discovered that this also happens when using gofmt (cmd/gofmt), so gofumpt is not the reason for this behaviour, it rather seems to be an issue in the code formatting that swag does or in gofmt itself.

I will continue to analyze this. If it's an issue in gofmt, I'll propose an update of that dependency one a fix has been made.

Thanks for your answer and the work on the tool in general!

@morremeyer
Copy link
Author

The issue was with my documentation, sorry for the fuzz here. Details in swaggo/swag#1386 (comment)

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