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

x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment: comments are removed #54333

Open
yuyongbo opened this issue Aug 8, 2022 · 1 comment
Labels
Analysis Issues related to static analysis (vet, x/tools/go/analysis) NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@yuyongbo
Copy link

yuyongbo commented Aug 8, 2022

What version of Go are you using (go version)?

$ go version
go version go1.16.13 darwin/arm64

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

What did you do?

When I execute the following command, I found that the field comments in the fixed struct are not preserved, you can try it, I don't quite understand why the original comments are removed. Please take a look, thank you.

$ fieldalignment -fix ./... 

What did you expect to see?

type UserLoginStatus struct {
	Type        uint8  `json:"type"`                   // 1:online,2: offline
	UserID      string `json:"user_id"`                // userid
	DeviceID    string `json:"device_id"`              // IMEI
}

What did you see instead?

type UserLoginStatus struct {
	UserID      string `json:"user_id"`                
	DeviceID    string `json:"device_id"`        
        Type        uint8  `json:"type"`                      
}
@seankhliao seankhliao changed the title affected/package: x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment , field comment are removed? x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment: comments are removed Aug 8, 2022
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Aug 8, 2022
@gopherbot gopherbot added this to the Unreleased milestone Aug 8, 2022
@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed Tools This label describes issues relating to any tools in the x/tools repository. labels Aug 8, 2022
@adonovan adonovan added the Analysis Issues related to static analysis (vet, x/tools/go/analysis) label Apr 23, 2023
@githubzhaoqian
Copy link

mark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Analysis Issues related to static analysis (vet, x/tools/go/analysis) NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants