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/cmd/goimports: allow multiple -local flags #19188

Closed
gregory-m opened this issue Feb 19, 2017 · 7 comments
Closed

x/tools/cmd/goimports: allow multiple -local flags #19188

gregory-m opened this issue Feb 19, 2017 · 7 comments

Comments

@gregory-m
Copy link
Contributor

My company use flowing imports schema:

import (
    "some-std-lib"
    "other-std-lib"

    "github.com/some/dependency"
    "github.com/some/other-dependency"

    "mycompany.com/foo/bar"
    "mycompany.com/foo/baz"
)

goimports perfectly supports such imports schema by using -local flag.

But our company acquire some other company and they code also become local to us, e.g. we want to use flowing imports schema:

import (
    "some-std-lib"
    "other-std-lib"

    "github.com/some/dependency"
    "github.com/some/other-dependency"

    "mycompany.com/foo/bar"
    "mycompany.com/foo/baz"
    "othercompany.com/foo/bar"
)

Can we add multiple -local flags support to goimports?
If no objections I will create CL.

@bradfitz
Copy link
Contributor

Seems like your company is big enough now to warrant having a internal fork of goimports with your desired policy.

I forgot about the -local flag. I don't normally approve flag additions, especially to goimports where users don't really run it by hand.

But sure. Since it's already there, feel free to make it support comma-separated value or something. That's probably the least invasive.

@bradfitz bradfitz added this to the Unreleased milestone Feb 19, 2017
@mvdan
Copy link
Member

mvdan commented Feb 19, 2017

especially to goimports where users don't really run it by hand.

I'm curious, why do you think that? I do run it manually quite often.

@bradfitz
Copy link
Contributor

I'm pretty sure that almost all users run it automatically from their editor on save, and not by hand.

@mvdan
Copy link
Member

mvdan commented Feb 19, 2017

Sure, but editors can still make use of these options if I understand correctly.

@gopherbot
Copy link

CL https://golang.org/cl/37592 mentions this issue.

@gopherbot
Copy link

Change https://golang.org/cl/85397 mentions this issue: cmd/goimports, imports: support multiple import paths in -local flag

@cjcjameson
Copy link

next level for this would be to fix the ordering more strictly based on the comma-separated list, but good enough for now. Thank you for this feature!

@golang golang locked and limited conversation to collaborators Dec 13, 2019
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

5 participants