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

goimports customization #43365

Closed
pjebs opened this issue Dec 24, 2020 · 3 comments
Closed

goimports customization #43365

pjebs opened this issue Dec 24, 2020 · 3 comments

Comments

@pjebs
Copy link
Contributor

pjebs commented Dec 24, 2020

There should be a way to customize the behavior of goimports and gofmt so that the golang.org/x/... packages are grouped with the standard library.

I (and prob many others) consider them to be de-facto standard library packages. It's just annoying when goimports mixes it up with "regular" 3rd party packages.

@mengzhuo
Copy link
Contributor

I think it's correct that category "golang.org/x" packages as 3rd party.
The "x" means "experimental" packages and might changed without any backward compatibility.

@pjebs
Copy link
Contributor Author

pjebs commented Dec 24, 2020

I understand that they don't have same backward compatibility promise.

I just want to configure goimports so for me (and other others) it gets grouped with standard library. That way, in the future (whether the API changes or not), when it gets moved to the standard library and the import path gets changed it looks nicer having to make a smaller change (i.e path change and/or removal) and not having to MOVE it to top + path change and/or removal.

@mengzhuo
Copy link
Contributor

You can simply group them into in one group and goimports will leave them alone.

"fmt"

"golang.org/x/net"
"golang.org/x/text"

"some-awesome-3rd-package"

@pjebs pjebs closed this as completed Dec 24, 2020
@golang golang locked and limited conversation to collaborators Dec 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants