Closed DavidJFelix closed 6 years ago
Hi @DavidJFelix, thanks for reporting.
This is expected behavior. The reason you're seeing a difference is because you're using gofmt
from Go 1.10. There have been changes to gofmt
formatting behavior from Go 1.10 to Go 1.11, and the current version of vfsgen
aims to generate code compatible with gofmt
from Go 1.11 (the current release).
If you use gofmt
from Go 1.11, there should not be any formatting issues with the generated code.
See commit message of commit 02ddb050ef6bbe4c2900677ac0df7e9e336d7032 for more details.
yep. I see it now. I upgraded to 11 and it goes away. Also saw an issue in go's code about different gofmt versions outputting different values with the issue marked "Unfortunate" 🤣 I'll close this. Thanks for the fast response.
Information
I'm not actually sure what rules
go fmt
is using to handle column alignment, but it seems like it has a limit to how much the two lines it tries to match are differing. When I rungo fmt
it modifies generated code to fit the go standard style.Using:
Expected
go generate
will generate code thatgo fmt
does not attempt to change.Actual
go generate
creates this linewhich
go fmt
will change to:Reproduce
Run
go fmt
on code generated by vfsgen.