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

cmd/gofmt: feature request: order methods #27041

Closed
ivanivanyuk1993 opened this issue Aug 16, 2018 · 2 comments
Closed

cmd/gofmt: feature request: order methods #27041

ivanivanyuk1993 opened this issue Aug 16, 2018 · 2 comments

Comments

@ivanivanyuk1993
Copy link

@ivanivanyuk1993 ivanivanyuk1993 commented Aug 16, 2018

When I run formatter, I expect all exported variables and methods to be in the beginning of file, ordered by name, followed by all not exported variables.

When I run formatter, methods and variables do not change their order, hence I have to order them manually

@bradfitz bradfitz changed the title Feature request: order methods cmd/gofmt: feature request: order methods Aug 16, 2018
@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Aug 16, 2018

Sorry, this is an area where gofmt doesn't want to have opinions.

Fortunately Go makes it easy to write your own tools to do this using the go/* packages. For example, goimports and goreturns are other tools that rewrite code (like gofmt), but make difference choices.

I suggest you write a tool to do the thing you want and you can advertise it here.

@bradfitz bradfitz closed this Aug 16, 2018
@ivanivanyuk1993
Copy link
Author

@ivanivanyuk1993 ivanivanyuk1993 commented Aug 18, 2018

@golang golang locked and limited conversation to collaborators Aug 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.