Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
x/tools/cmd/goimports: support gofmt option to simplify code #21476
This means that
There are no problems identified by
FWIW, it's a historical artifact that the simplify (-s) mechanism is implemented as part of the gofmt command. I think AST simplification (and rewriting) should be factored out and provided via separate libraries. Then those libraries could be trivially used from other places (incl. gofmt or goimports if so desired).
@jimeh goimports already does more than gofmt. I'm just suggesting that simplifications such as this should be factored out into a separate library. Maybe that library is used by gofmt and goimports, or just goimports. But the main point is that the code should be isolated into a separate package.